ovellum 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -58,10 +58,12 @@ var DEFAULT_CONFIG = {
58
58
  search: { enabled: false },
59
59
  pageMeta: { readingTime: true, lastModified: true },
60
60
  topbarNav: [],
61
+ footerNav: [],
61
62
  landing: {
62
63
  enabled: false,
63
64
  hero: { ctas: [] },
64
- features: []
65
+ features: [],
66
+ scenes: []
65
67
  }
66
68
  }
67
69
  };
@@ -253,6 +255,33 @@ function validateUserConfig(input2) {
253
255
  if (typeof item.href !== "string") {
254
256
  throw new ConfigError(`\`${path23}.href\` must be a string.`);
255
257
  }
258
+ if (item.icon !== void 0 && typeof item.icon !== "string") {
259
+ throw new ConfigError(`\`${path23}.icon\` must be a string.`);
260
+ }
261
+ if (item.external !== void 0 && typeof item.external !== "boolean") {
262
+ throw new ConfigError(`\`${path23}.external\` must be a boolean.`);
263
+ }
264
+ });
265
+ }
266
+ if (s.version !== void 0 && typeof s.version !== "string") {
267
+ throw new ConfigError("`site.version` must be a string when set.");
268
+ }
269
+ if (s.footerNav !== void 0) {
270
+ if (!Array.isArray(s.footerNav)) {
271
+ throw new ConfigError("`site.footerNav` must be an array.");
272
+ }
273
+ s.footerNav.forEach((item, i) => {
274
+ const path23 = `site.footerNav[${i}]`;
275
+ if (!isPlainObject(item)) throw new ConfigError(`\`${path23}\` must be an object.`);
276
+ if (typeof item.label !== "string") {
277
+ throw new ConfigError(`\`${path23}.label\` must be a string.`);
278
+ }
279
+ if (typeof item.href !== "string") {
280
+ throw new ConfigError(`\`${path23}.href\` must be a string.`);
281
+ }
282
+ if (item.icon !== void 0 && typeof item.icon !== "string") {
283
+ throw new ConfigError(`\`${path23}.icon\` must be a string.`);
284
+ }
256
285
  if (item.external !== void 0 && typeof item.external !== "boolean") {
257
286
  throw new ConfigError(`\`${path23}.external\` must be a boolean.`);
258
287
  }
@@ -301,6 +330,7 @@ function validateLanding(value) {
301
330
  }
302
331
  h.ctas.forEach((cta, i) => validateCta(cta, `site.landing.hero.ctas[${i}]`));
303
332
  }
333
+ if (h.media !== void 0) validateHeroMedia(h.media);
304
334
  }
305
335
  if (l.features !== void 0) {
306
336
  if (!Array.isArray(l.features)) {
@@ -308,6 +338,12 @@ function validateLanding(value) {
308
338
  }
309
339
  l.features.forEach((f, i) => validateFeature(f, `site.landing.features[${i}]`));
310
340
  }
341
+ if (l.scenes !== void 0) {
342
+ if (!Array.isArray(l.scenes)) {
343
+ throw new ConfigError("`site.landing.scenes` must be an array.");
344
+ }
345
+ l.scenes.forEach((s, i) => validateScene(s, `site.landing.scenes[${i}]`));
346
+ }
311
347
  if (l.trustStrip !== void 0) {
312
348
  if (!isPlainObject(l.trustStrip)) {
313
349
  throw new ConfigError("`site.landing.trustStrip` must be an object.");
@@ -324,6 +360,21 @@ function validateLanding(value) {
324
360
  }
325
361
  }
326
362
  }
363
+ function validateHeroMedia(value) {
364
+ if (!isPlainObject(value)) {
365
+ throw new ConfigError("`site.landing.hero.media` must be an object.");
366
+ }
367
+ const m = value;
368
+ if (typeof m.light !== "string" || m.light.length === 0) {
369
+ throw new ConfigError("`site.landing.hero.media.light` must be a non-empty string path.");
370
+ }
371
+ if (m.dark !== void 0 && typeof m.dark !== "string") {
372
+ throw new ConfigError("`site.landing.hero.media.dark` must be a string path.");
373
+ }
374
+ if (m.alt !== void 0 && typeof m.alt !== "string") {
375
+ throw new ConfigError("`site.landing.hero.media.alt` must be a string.");
376
+ }
377
+ }
327
378
  function validateCta(value, path23) {
328
379
  if (!isPlainObject(value)) throw new ConfigError(`\`${path23}\` must be an object.`);
329
380
  const c = value;
@@ -344,6 +395,19 @@ function validateFeature(value, path23) {
344
395
  throw new ConfigError(`\`${path23}.icon\` must be a string.`);
345
396
  }
346
397
  }
398
+ function validateScene(value, path23) {
399
+ if (!isPlainObject(value)) throw new ConfigError(`\`${path23}\` must be an object.`);
400
+ const s = value;
401
+ if (typeof s.light !== "string" || s.light.length === 0) {
402
+ throw new ConfigError(`\`${path23}.light\` must be a non-empty string path.`);
403
+ }
404
+ if (s.dark !== void 0 && typeof s.dark !== "string") {
405
+ throw new ConfigError(`\`${path23}.dark\` must be a string path.`);
406
+ }
407
+ if (s.alt !== void 0 && typeof s.alt !== "string") {
408
+ throw new ConfigError(`\`${path23}.alt\` must be a string.`);
409
+ }
410
+ }
347
411
  function validateTrustItem(value, path23) {
348
412
  if (!isPlainObject(value)) throw new ConfigError(`\`${path23}\` must be an object.`);
349
413
  const t = value;
@@ -418,8 +482,8 @@ function emptyJsDocInfo() {
418
482
  tags: {}
419
483
  };
420
484
  }
421
- function extractJsDoc(node) {
422
- const blocks = node.getJsDocs();
485
+ function extractJsDoc(node2) {
486
+ const blocks = node2.getJsDocs();
423
487
  if (blocks.length === 0) return emptyJsDocInfo();
424
488
  const block = blocks[blocks.length - 1];
425
489
  return parseBlock(block);
@@ -484,11 +548,11 @@ function readComment(tag) {
484
548
  return (raw ?? "").replace(/^\s*-\s*/, "").trim();
485
549
  }
486
550
  function readParamName(tag) {
487
- const node = tag.compilerNode;
488
- const named = node.name?.getText?.();
551
+ const node2 = tag.compilerNode;
552
+ const named = node2.name?.getText?.();
489
553
  if (named) return named;
490
- const text = tag.getText();
491
- const match = text.match(/@param\s+(?:\{[^}]*\}\s+)?([A-Za-z_$][\w$]*)/);
554
+ const text3 = tag.getText();
555
+ const match = text3.match(/@param\s+(?:\{[^}]*\}\s+)?([A-Za-z_$][\w$]*)/);
492
556
  return match ? match[1] : void 0;
493
557
  }
494
558
  function extractFromFile(sf, ctx) {
@@ -520,7 +584,7 @@ function fromFunction(fn, ctx) {
520
584
  returnType: returnTypeText,
521
585
  isAsync: fn.isAsync()
522
586
  });
523
- const node = {
587
+ const node2 = {
524
588
  id: anchorId(ctx.relPath, name),
525
589
  kind: "function",
526
590
  name,
@@ -537,8 +601,8 @@ function fromFunction(fn, ctx) {
537
601
  description: jsdoc.returnsDescription
538
602
  }
539
603
  };
540
- attachJsDocFields(node, jsdoc);
541
- return [node];
604
+ attachJsDocFields(node2, jsdoc);
605
+ return [node2];
542
606
  }
543
607
  function fromClass(cls, ctx) {
544
608
  const name = cls.getName();
@@ -565,7 +629,7 @@ function fromClass(cls, ctx) {
565
629
  const childNode = fromProperty(prop, ctx, name);
566
630
  if (childNode) children.push(childNode);
567
631
  }
568
- const node = {
632
+ const node2 = {
569
633
  id: anchorId(ctx.relPath, name),
570
634
  kind: "class",
571
635
  name,
@@ -578,8 +642,8 @@ function fromClass(cls, ctx) {
578
642
  tags: jsdoc.tags,
579
643
  children: children.length ? children : void 0
580
644
  };
581
- attachJsDocFields(node, jsdoc);
582
- return [node];
645
+ attachJsDocFields(node2, jsdoc);
646
+ return [node2];
583
647
  }
584
648
  function fromMethod(method, ctx, className) {
585
649
  const name = method.getName();
@@ -592,7 +656,7 @@ function fromMethod(method, ctx, className) {
592
656
  const generics = method.getTypeParameters().map((tp) => tp.getText());
593
657
  const gen = generics.length ? `<${generics.join(", ")}>` : "";
594
658
  const signature = `${name}${gen}(${method.getParameters().map(paramSignaturePart).join(", ")}): ${returnTypeText}`;
595
- const node = {
659
+ const node2 = {
596
660
  id: anchorId(ctx.relPath, `${className}.${name}`),
597
661
  kind: "method",
598
662
  name,
@@ -609,8 +673,8 @@ function fromMethod(method, ctx, className) {
609
673
  description: jsdoc.returnsDescription
610
674
  }
611
675
  };
612
- attachJsDocFields(node, jsdoc);
613
- return node;
676
+ attachJsDocFields(node2, jsdoc);
677
+ return node2;
614
678
  }
615
679
  function fromProperty(prop, ctx, className) {
616
680
  const name = prop.getName();
@@ -619,7 +683,7 @@ function fromProperty(prop, ctx, className) {
619
683
  if (isPrivate && !ctx.config.includePrivate && !ctx.config.includeInternal) return void 0;
620
684
  if (jsdoc.internal && !ctx.config.includeInternal) return void 0;
621
685
  const typeText = prop.getTypeNode()?.getText() ?? prop.getType().getText(prop);
622
- const node = {
686
+ const node2 = {
623
687
  id: anchorId(ctx.relPath, `${className}.${name}`),
624
688
  kind: "property",
625
689
  name,
@@ -631,8 +695,8 @@ function fromProperty(prop, ctx, className) {
631
695
  isPreserved: jsdoc.preserved,
632
696
  tags: jsdoc.tags
633
697
  };
634
- attachJsDocFields(node, jsdoc);
635
- return node;
698
+ attachJsDocFields(node2, jsdoc);
699
+ return node2;
636
700
  }
637
701
  function fromInterface(iface, ctx) {
638
702
  const name = iface.getName();
@@ -687,7 +751,7 @@ function fromInterface(iface, ctx) {
687
751
  attachJsDocFields(methodNode, methodJsdoc);
688
752
  children.push(methodNode);
689
753
  }
690
- const node = {
754
+ const node2 = {
691
755
  id: anchorId(ctx.relPath, name),
692
756
  kind: "interface",
693
757
  name,
@@ -700,8 +764,8 @@ function fromInterface(iface, ctx) {
700
764
  tags: jsdoc.tags,
701
765
  children: children.length ? children : void 0
702
766
  };
703
- attachJsDocFields(node, jsdoc);
704
- return [node];
767
+ attachJsDocFields(node2, jsdoc);
768
+ return [node2];
705
769
  }
706
770
  function fromTypeAlias(alias, ctx) {
707
771
  const name = alias.getName();
@@ -711,7 +775,7 @@ function fromTypeAlias(alias, ctx) {
711
775
  const generics = alias.getTypeParameters().map((tp) => tp.getText());
712
776
  const gen = generics.length ? `<${generics.join(", ")}>` : "";
713
777
  const typeText = alias.getTypeNode()?.getText() ?? alias.getType().getText(alias);
714
- const node = {
778
+ const node2 = {
715
779
  id: anchorId(ctx.relPath, name),
716
780
  kind: "type",
717
781
  name,
@@ -723,8 +787,8 @@ function fromTypeAlias(alias, ctx) {
723
787
  isPreserved: jsdoc.preserved,
724
788
  tags: jsdoc.tags
725
789
  };
726
- attachJsDocFields(node, jsdoc);
727
- return [node];
790
+ attachJsDocFields(node2, jsdoc);
791
+ return [node2];
728
792
  }
729
793
  function fromEnum(en, ctx) {
730
794
  const name = en.getName();
@@ -751,7 +815,7 @@ function fromEnum(en, ctx) {
751
815
  attachJsDocFields(memberNode, memberJsdoc);
752
816
  return memberNode;
753
817
  });
754
- const node = {
818
+ const node2 = {
755
819
  id: anchorId(ctx.relPath, name),
756
820
  kind: "enum",
757
821
  name,
@@ -764,8 +828,8 @@ function fromEnum(en, ctx) {
764
828
  tags: jsdoc.tags,
765
829
  children
766
830
  };
767
- attachJsDocFields(node, jsdoc);
768
- return [node];
831
+ attachJsDocFields(node2, jsdoc);
832
+ return [node2];
769
833
  }
770
834
  function paramSignaturePart(p) {
771
835
  const name = p.getName();
@@ -796,12 +860,12 @@ function buildFunctionSignature(opts) {
796
860
  const asyncKw = opts.isAsync ? "async " : "";
797
861
  return `${asyncKw}function ${opts.name}${gen}(${opts.params.join(", ")}): ${opts.returnType}`;
798
862
  }
799
- function attachJsDocFields(node, jsdoc) {
800
- if (jsdoc.description) node.description = jsdoc.description;
801
- if (jsdoc.examples.length) node.examples = jsdoc.examples;
802
- if (jsdoc.throws.length) node.throws = jsdoc.throws;
803
- if (jsdoc.deprecated) node.deprecated = jsdoc.deprecated;
804
- if (jsdoc.since) node.since = jsdoc.since;
863
+ function attachJsDocFields(node2, jsdoc) {
864
+ if (jsdoc.description) node2.description = jsdoc.description;
865
+ if (jsdoc.examples.length) node2.examples = jsdoc.examples;
866
+ if (jsdoc.throws.length) node2.throws = jsdoc.throws;
867
+ if (jsdoc.deprecated) node2.deprecated = jsdoc.deprecated;
868
+ if (jsdoc.since) node2.since = jsdoc.since;
805
869
  }
806
870
  function parseProject(options) {
807
871
  const { config, cwd } = options;
@@ -897,38 +961,38 @@ function outputPathFor(sourceRelPath, config) {
897
961
  function stripLeadingDotSlash(p) {
898
962
  return p.replace(/^\.\/+/, "").replace(/\/+$/, "");
899
963
  }
900
- function renderNode(node) {
964
+ function renderNode(node2) {
901
965
  const parts = [];
902
- parts.push(headingFor(node));
903
- parts.push(anchorComment(node));
904
- parts.push(signatureBlock(node));
905
- if (node.deprecated) {
906
- parts.push(`> **Deprecated.** ${escapeInline(node.deprecated)}`);
966
+ parts.push(headingFor(node2));
967
+ parts.push(anchorComment(node2));
968
+ parts.push(signatureBlock(node2));
969
+ if (node2.deprecated) {
970
+ parts.push(`> **Deprecated.** ${escapeInline(node2.deprecated)}`);
907
971
  }
908
- if (node.description) {
909
- parts.push(node.description.trim());
972
+ if (node2.description) {
973
+ parts.push(node2.description.trim());
910
974
  }
911
- if (node.since) {
912
- parts.push(`*Since: ${escapeInline(node.since)}*`);
975
+ if (node2.since) {
976
+ parts.push(`*Since: ${escapeInline(node2.since)}*`);
913
977
  }
914
- if (node.params && node.params.length > 0) {
978
+ if (node2.params && node2.params.length > 0) {
915
979
  parts.push("**Parameters**");
916
- parts.push(paramsTable(node.params));
980
+ parts.push(paramsTable(node2.params));
917
981
  }
918
- if (node.returns && node.returns.type && node.returns.type !== "void") {
919
- const desc = node.returns.description ? ` - ${node.returns.description}` : "";
920
- parts.push(`**Returns** \`${node.returns.type}\`${desc}`);
982
+ if (node2.returns && node2.returns.type && node2.returns.type !== "void") {
983
+ const desc = node2.returns.description ? ` - ${node2.returns.description}` : "";
984
+ parts.push(`**Returns** \`${node2.returns.type}\`${desc}`);
921
985
  }
922
- if (node.throws && node.throws.length > 0) {
986
+ if (node2.throws && node2.throws.length > 0) {
923
987
  parts.push("**Throws**");
924
- for (const t of node.throws) parts.push(`- ${escapeInline(t)}`);
988
+ for (const t of node2.throws) parts.push(`- ${escapeInline(t)}`);
925
989
  }
926
- if (node.examples && node.examples.length > 0) {
990
+ if (node2.examples && node2.examples.length > 0) {
927
991
  parts.push("**Example**");
928
- for (const ex of node.examples) parts.push(fence(ex.trim(), "typescript"));
992
+ for (const ex of node2.examples) parts.push(fence(ex.trim(), "typescript"));
929
993
  }
930
- if (node.children && node.children.length > 0) {
931
- parts.push(renderChildren(node));
994
+ if (node2.children && node2.children.length > 0) {
995
+ parts.push(renderChildren(node2));
932
996
  }
933
997
  return parts.filter(Boolean).join("\n\n");
934
998
  }
@@ -959,25 +1023,25 @@ ${buckets.method.map(renderMember).join("\n\n")}`);
959
1023
  }
960
1024
  return sections.join("\n\n");
961
1025
  }
962
- function renderMember(node) {
1026
+ function renderMember(node2) {
963
1027
  const parts = [];
964
- parts.push(`##### \`${node.name}\``);
965
- parts.push(anchorComment(node));
966
- parts.push(fence(node.signature, "typescript"));
967
- if (node.description) parts.push(node.description.trim());
968
- if (node.params && node.params.length > 0) {
969
- parts.push(paramsTable(node.params));
1028
+ parts.push(`##### \`${node2.name}\``);
1029
+ parts.push(anchorComment(node2));
1030
+ parts.push(fence(node2.signature, "typescript"));
1031
+ if (node2.description) parts.push(node2.description.trim());
1032
+ if (node2.params && node2.params.length > 0) {
1033
+ parts.push(paramsTable(node2.params));
970
1034
  }
971
- if (node.returns && node.returns.type && node.returns.type !== "void") {
972
- parts.push(`Returns \`${node.returns.type}\``);
1035
+ if (node2.returns && node2.returns.type && node2.returns.type !== "void") {
1036
+ parts.push(`Returns \`${node2.returns.type}\``);
973
1037
  }
974
1038
  return parts.filter(Boolean).join("\n\n");
975
1039
  }
976
- function headingFor(node) {
977
- return `## \`${node.name}\``;
1040
+ function headingFor(node2) {
1041
+ return `## \`${node2.name}\``;
978
1042
  }
979
- function signatureBlock(node) {
980
- return fence(node.signature, "typescript");
1043
+ function signatureBlock(node2) {
1044
+ return fence(node2.signature, "typescript");
981
1045
  }
982
1046
  function paramsTable(params) {
983
1047
  const head = "| Name | Type | Description |\n| --- | --- | --- |";
@@ -1006,8 +1070,8 @@ function signatureTypeOnly(signature, name) {
1006
1070
  if (eqMatch) return eqMatch[1].trim();
1007
1071
  return signature;
1008
1072
  }
1009
- function anchorComment(node) {
1010
- return `<!-- ovellum:anchor id="${node.id}" generated="${(/* @__PURE__ */ new Date()).toISOString()}" -->`;
1073
+ function anchorComment(node2) {
1074
+ return `<!-- ovellum:anchor id="${node2.id}" generated="${(/* @__PURE__ */ new Date()).toISOString()}" -->`;
1011
1075
  }
1012
1076
  function fence(content, lang) {
1013
1077
  return "```" + lang + "\n" + content + "\n```";
@@ -1036,8 +1100,8 @@ function renderFile(file, generatedAt) {
1036
1100
  if (file.description) {
1037
1101
  parts.push(file.description.trim());
1038
1102
  }
1039
- for (const node of file.nodes) {
1040
- parts.push(renderNode(node));
1103
+ for (const node2 of file.nodes) {
1104
+ parts.push(renderNode(node2));
1041
1105
  }
1042
1106
  return parts.filter(Boolean).join("\n\n") + "\n";
1043
1107
  }
@@ -1151,7 +1215,15 @@ function parseManualDoc(raw, filePath) {
1151
1215
  const frontmatter = parsed.data ?? {};
1152
1216
  const content = parsed.content;
1153
1217
  const protectedBlocks = extractProtectedZones(content);
1154
- return { filePath, frontmatter, content, protectedBlocks };
1218
+ const warnings = [];
1219
+ for (const block of protectedBlocks) {
1220
+ if (!block.hasExplicitId) {
1221
+ warnings.push(
1222
+ `${filePath}:${block.startLine}: protected zone "${block.id}" uses a positional fallback id. Add id="..." on the <!-- @manual:start --> tag so the block survives reordering.`
1223
+ );
1224
+ }
1225
+ }
1226
+ return { filePath, frontmatter, content, protectedBlocks, warnings };
1155
1227
  }
1156
1228
 
1157
1229
  // ../merger/dist/index.js
@@ -1167,146 +1239,3588 @@ function findAnchors(content) {
1167
1239
  if (!id) continue;
1168
1240
  out.push({ id, index: m.index, endIndex: m.index + m[0].length });
1169
1241
  }
1170
- return out;
1242
+ return out;
1243
+ }
1244
+ function merge(generated, manual, options = {}) {
1245
+ const orphans = [];
1246
+ const warnings = [];
1247
+ const now = options.now ?? (/* @__PURE__ */ new Date()).toISOString();
1248
+ const sourceFile = options.sourceFile ?? manual.filePath;
1249
+ const anchorToBlocks = /* @__PURE__ */ new Map();
1250
+ const anchorless = [];
1251
+ for (const block of manual.protectedBlocks) {
1252
+ if (!block.anchorId) {
1253
+ anchorless.push(block);
1254
+ continue;
1255
+ }
1256
+ let list2 = anchorToBlocks.get(block.anchorId);
1257
+ if (!list2) {
1258
+ list2 = [];
1259
+ anchorToBlocks.set(block.anchorId, list2);
1260
+ }
1261
+ list2.push(block);
1262
+ }
1263
+ for (const block of anchorless) {
1264
+ warnings.push(`Protected block ${block.id} has no associated anchor \u2014 treated as orphan.`);
1265
+ orphans.push(orphanFromBlock(block, void 0, sourceFile, now));
1266
+ }
1267
+ const anchors = findAnchors(generated);
1268
+ if (anchors.length === 0) {
1269
+ for (const [anchorId2, blocks] of anchorToBlocks) {
1270
+ for (const block of blocks) {
1271
+ orphans.push(orphanFromBlock(block, anchorId2, sourceFile, now));
1272
+ }
1273
+ }
1274
+ return { content: generated, orphans, warnings };
1275
+ }
1276
+ const pieces = [];
1277
+ let cursor = 0;
1278
+ for (let i = 0; i < anchors.length; i++) {
1279
+ const anchor = anchors[i];
1280
+ const sectionEnd = findSectionEnd(generated, anchor.endIndex);
1281
+ pieces.push(generated.slice(cursor, sectionEnd));
1282
+ const blocks = anchorToBlocks.get(anchor.id);
1283
+ if (blocks && blocks.length > 0) {
1284
+ pieces.push(renderBlocks(blocks));
1285
+ anchorToBlocks.delete(anchor.id);
1286
+ }
1287
+ cursor = sectionEnd;
1288
+ }
1289
+ if (cursor < generated.length) {
1290
+ pieces.push(generated.slice(cursor));
1291
+ }
1292
+ for (const [anchorId2, blocks] of anchorToBlocks) {
1293
+ for (const block of blocks) {
1294
+ orphans.push(orphanFromBlock(block, anchorId2, sourceFile, now));
1295
+ }
1296
+ }
1297
+ return { content: pieces.join(""), orphans, warnings };
1298
+ }
1299
+ function findSectionEnd(content, from) {
1300
+ const re = /\n(#{1,6} )/g;
1301
+ re.lastIndex = from;
1302
+ const m = re.exec(content);
1303
+ return m ? m.index + 1 : content.length;
1304
+ }
1305
+ function renderBlocks(blocks) {
1306
+ return blocks.map((b) => renderBlock(b)).join("\n");
1307
+ }
1308
+ function renderBlock(block) {
1309
+ const idAttr = block.hasExplicitId ? ` id="${block.id}"` : "";
1310
+ return `<!-- @manual:start${idAttr} -->
1311
+ ${block.content}
1312
+ <!-- @manual:end -->
1313
+
1314
+ `;
1315
+ }
1316
+ function orphanFromBlock(block, anchorId2, sourceFile, orphanedAt) {
1317
+ const out = {
1318
+ orphanedAt,
1319
+ sourceFile,
1320
+ anchorId: anchorId2 ?? "unknown",
1321
+ content: block.content
1322
+ };
1323
+ if (block.hasExplicitId) out.manualBlockId = block.id;
1324
+ return out;
1325
+ }
1326
+ function slugifyAnchor(anchorId2) {
1327
+ return anchorId2.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
1328
+ }
1329
+ function formatDateUTC(d) {
1330
+ const y = d.getUTCFullYear();
1331
+ const m = String(d.getUTCMonth() + 1).padStart(2, "0");
1332
+ const day = String(d.getUTCDate()).padStart(2, "0");
1333
+ return `${y}-${m}-${day}`;
1334
+ }
1335
+ function renderOrphanFile(record) {
1336
+ const fields = {
1337
+ orphaned: record.orphanedAt,
1338
+ source_file: record.sourceFile,
1339
+ anchor_id: record.anchorId
1340
+ };
1341
+ if (record.anchorLastSeen) fields.anchor_last_seen = record.anchorLastSeen;
1342
+ if (record.manualBlockId) fields.manual_block_id = record.manualBlockId;
1343
+ const yaml = Object.entries(fields).map(([k, v]) => `${k}: ${formatYamlScalar2(v)}`).join("\n");
1344
+ return `---
1345
+ ${yaml}
1346
+ ---
1347
+
1348
+ ${record.content}
1349
+ `;
1350
+ }
1351
+ async function writeOrphan(record, orphanDir) {
1352
+ const slug = slugifyAnchor(record.anchorId);
1353
+ const dateStamp = formatDateUTC(new Date(record.orphanedAt));
1354
+ const filename = `${dateStamp}_${slug}.md`;
1355
+ const absPath = import_path4.default.resolve(orphanDir, filename);
1356
+ await (0, import_promises2.mkdir)(orphanDir, { recursive: true });
1357
+ await (0, import_promises2.writeFile)(absPath, renderOrphanFile(record), "utf8");
1358
+ return absPath;
1359
+ }
1360
+ function formatYamlScalar2(s) {
1361
+ if (/[:#\-?{}[\],&*!|>'"%@`]/.test(s) || /^\s|\s$/.test(s)) {
1362
+ return `'${s.replace(/'/g, "''")}'`;
1363
+ }
1364
+ return s;
1365
+ }
1366
+
1367
+ // ../site/dist/index.js
1368
+ var import_fs2 = require("fs");
1369
+ var import_promises3 = require("fs/promises");
1370
+ var import_path5 = __toESM(require("path"), 1);
1371
+ var import_url = require("url");
1372
+ var import_gray_matter2 = __toESM(require("gray-matter"), 1);
1373
+ var import_unified = require("unified");
1374
+ var import_remark_parse = __toESM(require("remark-parse"), 1);
1375
+
1376
+ // ../../node_modules/.pnpm/ccount@2.0.1/node_modules/ccount/index.js
1377
+ function ccount(value, character) {
1378
+ const source = String(value);
1379
+ if (typeof character !== "string") {
1380
+ throw new TypeError("Expected character");
1381
+ }
1382
+ let count = 0;
1383
+ let index = source.indexOf(character);
1384
+ while (index !== -1) {
1385
+ count++;
1386
+ index = source.indexOf(character, index + character.length);
1387
+ }
1388
+ return count;
1389
+ }
1390
+
1391
+ // ../../node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.js
1392
+ function ok() {
1393
+ }
1394
+
1395
+ // ../../node_modules/.pnpm/micromark-util-character@2.1.1/node_modules/micromark-util-character/index.js
1396
+ var asciiAlpha = regexCheck(/[A-Za-z]/);
1397
+ var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
1398
+ var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
1399
+ function asciiControl(code3) {
1400
+ return (
1401
+ // Special whitespace codes (which have negative values), C0 and Control
1402
+ // character DEL
1403
+ code3 !== null && (code3 < 32 || code3 === 127)
1404
+ );
1405
+ }
1406
+ var asciiDigit = regexCheck(/\d/);
1407
+ var asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
1408
+ var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
1409
+ function markdownLineEnding(code3) {
1410
+ return code3 !== null && code3 < -2;
1411
+ }
1412
+ function markdownLineEndingOrSpace(code3) {
1413
+ return code3 !== null && (code3 < 0 || code3 === 32);
1414
+ }
1415
+ function markdownSpace(code3) {
1416
+ return code3 === -2 || code3 === -1 || code3 === 32;
1417
+ }
1418
+ var unicodePunctuation = regexCheck(new RegExp("\\p{P}|\\p{S}", "u"));
1419
+ var unicodeWhitespace = regexCheck(/\s/);
1420
+ function regexCheck(regex) {
1421
+ return check;
1422
+ function check(code3) {
1423
+ return code3 !== null && code3 > -1 && regex.test(String.fromCharCode(code3));
1424
+ }
1425
+ }
1426
+
1427
+ // ../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
1428
+ function escapeStringRegexp(string) {
1429
+ if (typeof string !== "string") {
1430
+ throw new TypeError("Expected a string");
1431
+ }
1432
+ return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
1433
+ }
1434
+
1435
+ // ../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js
1436
+ var convert = (
1437
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
1438
+ /**
1439
+ * @type {(
1440
+ * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
1441
+ * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
1442
+ * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
1443
+ * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
1444
+ * ((test?: Test) => Check)
1445
+ * )}
1446
+ */
1447
+ /**
1448
+ * @param {Test} [test]
1449
+ * @returns {Check}
1450
+ */
1451
+ (function(test) {
1452
+ if (test === null || test === void 0) {
1453
+ return ok2;
1454
+ }
1455
+ if (typeof test === "function") {
1456
+ return castFactory(test);
1457
+ }
1458
+ if (typeof test === "object") {
1459
+ return Array.isArray(test) ? anyFactory(test) : (
1460
+ // Cast because `ReadonlyArray` goes into the above but `isArray`
1461
+ // narrows to `Array`.
1462
+ propertiesFactory(
1463
+ /** @type {Props} */
1464
+ test
1465
+ )
1466
+ );
1467
+ }
1468
+ if (typeof test === "string") {
1469
+ return typeFactory(test);
1470
+ }
1471
+ throw new Error("Expected function, string, or object as test");
1472
+ })
1473
+ );
1474
+ function anyFactory(tests) {
1475
+ const checks = [];
1476
+ let index = -1;
1477
+ while (++index < tests.length) {
1478
+ checks[index] = convert(tests[index]);
1479
+ }
1480
+ return castFactory(any);
1481
+ function any(...parameters) {
1482
+ let index2 = -1;
1483
+ while (++index2 < checks.length) {
1484
+ if (checks[index2].apply(this, parameters)) return true;
1485
+ }
1486
+ return false;
1487
+ }
1488
+ }
1489
+ function propertiesFactory(check) {
1490
+ const checkAsRecord = (
1491
+ /** @type {Record<string, unknown>} */
1492
+ check
1493
+ );
1494
+ return castFactory(all2);
1495
+ function all2(node2) {
1496
+ const nodeAsRecord = (
1497
+ /** @type {Record<string, unknown>} */
1498
+ /** @type {unknown} */
1499
+ node2
1500
+ );
1501
+ let key;
1502
+ for (key in check) {
1503
+ if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
1504
+ }
1505
+ return true;
1506
+ }
1507
+ }
1508
+ function typeFactory(check) {
1509
+ return castFactory(type);
1510
+ function type(node2) {
1511
+ return node2 && node2.type === check;
1512
+ }
1513
+ }
1514
+ function castFactory(testFunction) {
1515
+ return check;
1516
+ function check(value, index, parent) {
1517
+ return Boolean(
1518
+ looksLikeANode(value) && testFunction.call(
1519
+ this,
1520
+ value,
1521
+ typeof index === "number" ? index : void 0,
1522
+ parent || void 0
1523
+ )
1524
+ );
1525
+ }
1526
+ }
1527
+ function ok2() {
1528
+ return true;
1529
+ }
1530
+ function looksLikeANode(value) {
1531
+ return value !== null && typeof value === "object" && "type" in value;
1532
+ }
1533
+
1534
+ // ../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.js
1535
+ function color(d) {
1536
+ return "\x1B[33m" + d + "\x1B[39m";
1537
+ }
1538
+
1539
+ // ../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.js
1540
+ var empty = [];
1541
+ var CONTINUE = true;
1542
+ var EXIT = false;
1543
+ var SKIP = "skip";
1544
+ function visitParents(tree, test, visitor, reverse) {
1545
+ let check;
1546
+ if (typeof test === "function" && typeof visitor !== "function") {
1547
+ reverse = visitor;
1548
+ visitor = test;
1549
+ } else {
1550
+ check = test;
1551
+ }
1552
+ const is2 = convert(check);
1553
+ const step = reverse ? -1 : 1;
1554
+ factory(tree, void 0, [])();
1555
+ function factory(node2, index, parents) {
1556
+ const value = (
1557
+ /** @type {Record<string, unknown>} */
1558
+ node2 && typeof node2 === "object" ? node2 : {}
1559
+ );
1560
+ if (typeof value.type === "string") {
1561
+ const name = (
1562
+ // `hast`
1563
+ typeof value.tagName === "string" ? value.tagName : (
1564
+ // `xast`
1565
+ typeof value.name === "string" ? value.name : void 0
1566
+ )
1567
+ );
1568
+ Object.defineProperty(visit3, "name", {
1569
+ value: "node (" + color(node2.type + (name ? "<" + name + ">" : "")) + ")"
1570
+ });
1571
+ }
1572
+ return visit3;
1573
+ function visit3() {
1574
+ let result = empty;
1575
+ let subresult;
1576
+ let offset;
1577
+ let grandparents;
1578
+ if (!test || is2(node2, index, parents[parents.length - 1] || void 0)) {
1579
+ result = toResult(visitor(node2, parents));
1580
+ if (result[0] === EXIT) {
1581
+ return result;
1582
+ }
1583
+ }
1584
+ if ("children" in node2 && node2.children) {
1585
+ const nodeAsParent = (
1586
+ /** @type {UnistParent} */
1587
+ node2
1588
+ );
1589
+ if (nodeAsParent.children && result[0] !== SKIP) {
1590
+ offset = (reverse ? nodeAsParent.children.length : -1) + step;
1591
+ grandparents = parents.concat(nodeAsParent);
1592
+ while (offset > -1 && offset < nodeAsParent.children.length) {
1593
+ const child = nodeAsParent.children[offset];
1594
+ subresult = factory(child, offset, grandparents)();
1595
+ if (subresult[0] === EXIT) {
1596
+ return subresult;
1597
+ }
1598
+ offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
1599
+ }
1600
+ }
1601
+ }
1602
+ return result;
1603
+ }
1604
+ }
1605
+ }
1606
+ function toResult(value) {
1607
+ if (Array.isArray(value)) {
1608
+ return value;
1609
+ }
1610
+ if (typeof value === "number") {
1611
+ return [CONTINUE, value];
1612
+ }
1613
+ return value === null || value === void 0 ? empty : [value];
1614
+ }
1615
+
1616
+ // ../../node_modules/.pnpm/mdast-util-find-and-replace@3.0.2/node_modules/mdast-util-find-and-replace/lib/index.js
1617
+ function findAndReplace(tree, list2, options) {
1618
+ const settings = options || {};
1619
+ const ignored = convert(settings.ignore || []);
1620
+ const pairs = toPairs(list2);
1621
+ let pairIndex = -1;
1622
+ while (++pairIndex < pairs.length) {
1623
+ visitParents(tree, "text", visitor);
1624
+ }
1625
+ function visitor(node2, parents) {
1626
+ let index = -1;
1627
+ let grandparent;
1628
+ while (++index < parents.length) {
1629
+ const parent = parents[index];
1630
+ const siblings = grandparent ? grandparent.children : void 0;
1631
+ if (ignored(
1632
+ parent,
1633
+ siblings ? siblings.indexOf(parent) : void 0,
1634
+ grandparent
1635
+ )) {
1636
+ return;
1637
+ }
1638
+ grandparent = parent;
1639
+ }
1640
+ if (grandparent) {
1641
+ return handler(node2, parents);
1642
+ }
1643
+ }
1644
+ function handler(node2, parents) {
1645
+ const parent = parents[parents.length - 1];
1646
+ const find = pairs[pairIndex][0];
1647
+ const replace2 = pairs[pairIndex][1];
1648
+ let start = 0;
1649
+ const siblings = parent.children;
1650
+ const index = siblings.indexOf(node2);
1651
+ let change = false;
1652
+ let nodes = [];
1653
+ find.lastIndex = 0;
1654
+ let match = find.exec(node2.value);
1655
+ while (match) {
1656
+ const position = match.index;
1657
+ const matchObject = {
1658
+ index: match.index,
1659
+ input: match.input,
1660
+ stack: [...parents, node2]
1661
+ };
1662
+ let value = replace2(...match, matchObject);
1663
+ if (typeof value === "string") {
1664
+ value = value.length > 0 ? { type: "text", value } : void 0;
1665
+ }
1666
+ if (value === false) {
1667
+ find.lastIndex = position + 1;
1668
+ } else {
1669
+ if (start !== position) {
1670
+ nodes.push({
1671
+ type: "text",
1672
+ value: node2.value.slice(start, position)
1673
+ });
1674
+ }
1675
+ if (Array.isArray(value)) {
1676
+ nodes.push(...value);
1677
+ } else if (value) {
1678
+ nodes.push(value);
1679
+ }
1680
+ start = position + match[0].length;
1681
+ change = true;
1682
+ }
1683
+ if (!find.global) {
1684
+ break;
1685
+ }
1686
+ match = find.exec(node2.value);
1687
+ }
1688
+ if (change) {
1689
+ if (start < node2.value.length) {
1690
+ nodes.push({ type: "text", value: node2.value.slice(start) });
1691
+ }
1692
+ parent.children.splice(index, 1, ...nodes);
1693
+ } else {
1694
+ nodes = [node2];
1695
+ }
1696
+ return index + nodes.length;
1697
+ }
1698
+ }
1699
+ function toPairs(tupleOrList) {
1700
+ const result = [];
1701
+ if (!Array.isArray(tupleOrList)) {
1702
+ throw new TypeError("Expected find and replace tuple or list of tuples");
1703
+ }
1704
+ const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
1705
+ let index = -1;
1706
+ while (++index < list2.length) {
1707
+ const tuple = list2[index];
1708
+ result.push([toExpression(tuple[0]), toFunction(tuple[1])]);
1709
+ }
1710
+ return result;
1711
+ }
1712
+ function toExpression(find) {
1713
+ return typeof find === "string" ? new RegExp(escapeStringRegexp(find), "g") : find;
1714
+ }
1715
+ function toFunction(replace2) {
1716
+ return typeof replace2 === "function" ? replace2 : function() {
1717
+ return replace2;
1718
+ };
1719
+ }
1720
+
1721
+ // ../../node_modules/.pnpm/mdast-util-gfm-autolink-literal@2.0.1/node_modules/mdast-util-gfm-autolink-literal/lib/index.js
1722
+ var inConstruct = "phrasing";
1723
+ var notInConstruct = ["autolink", "link", "image", "label"];
1724
+ function gfmAutolinkLiteralFromMarkdown() {
1725
+ return {
1726
+ transforms: [transformGfmAutolinkLiterals],
1727
+ enter: {
1728
+ literalAutolink: enterLiteralAutolink,
1729
+ literalAutolinkEmail: enterLiteralAutolinkValue,
1730
+ literalAutolinkHttp: enterLiteralAutolinkValue,
1731
+ literalAutolinkWww: enterLiteralAutolinkValue
1732
+ },
1733
+ exit: {
1734
+ literalAutolink: exitLiteralAutolink,
1735
+ literalAutolinkEmail: exitLiteralAutolinkEmail,
1736
+ literalAutolinkHttp: exitLiteralAutolinkHttp,
1737
+ literalAutolinkWww: exitLiteralAutolinkWww
1738
+ }
1739
+ };
1740
+ }
1741
+ function gfmAutolinkLiteralToMarkdown() {
1742
+ return {
1743
+ unsafe: [
1744
+ {
1745
+ character: "@",
1746
+ before: "[+\\-.\\w]",
1747
+ after: "[\\-.\\w]",
1748
+ inConstruct,
1749
+ notInConstruct
1750
+ },
1751
+ {
1752
+ character: ".",
1753
+ before: "[Ww]",
1754
+ after: "[\\-.\\w]",
1755
+ inConstruct,
1756
+ notInConstruct
1757
+ },
1758
+ {
1759
+ character: ":",
1760
+ before: "[ps]",
1761
+ after: "\\/",
1762
+ inConstruct,
1763
+ notInConstruct
1764
+ }
1765
+ ]
1766
+ };
1767
+ }
1768
+ function enterLiteralAutolink(token) {
1769
+ this.enter({ type: "link", title: null, url: "", children: [] }, token);
1770
+ }
1771
+ function enterLiteralAutolinkValue(token) {
1772
+ this.config.enter.autolinkProtocol.call(this, token);
1773
+ }
1774
+ function exitLiteralAutolinkHttp(token) {
1775
+ this.config.exit.autolinkProtocol.call(this, token);
1776
+ }
1777
+ function exitLiteralAutolinkWww(token) {
1778
+ this.config.exit.data.call(this, token);
1779
+ const node2 = this.stack[this.stack.length - 1];
1780
+ ok(node2.type === "link");
1781
+ node2.url = "http://" + this.sliceSerialize(token);
1782
+ }
1783
+ function exitLiteralAutolinkEmail(token) {
1784
+ this.config.exit.autolinkEmail.call(this, token);
1785
+ }
1786
+ function exitLiteralAutolink(token) {
1787
+ this.exit(token);
1788
+ }
1789
+ function transformGfmAutolinkLiterals(tree) {
1790
+ findAndReplace(
1791
+ tree,
1792
+ [
1793
+ [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl],
1794
+ [new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)", "gu"), findEmail]
1795
+ ],
1796
+ { ignore: ["link", "linkReference"] }
1797
+ );
1798
+ }
1799
+ function findUrl(_, protocol, domain2, path16, match) {
1800
+ let prefix = "";
1801
+ if (!previous(match)) {
1802
+ return false;
1803
+ }
1804
+ if (/^w/i.test(protocol)) {
1805
+ domain2 = protocol + domain2;
1806
+ protocol = "";
1807
+ prefix = "http://";
1808
+ }
1809
+ if (!isCorrectDomain(domain2)) {
1810
+ return false;
1811
+ }
1812
+ const parts = splitUrl(domain2 + path16);
1813
+ if (!parts[0]) return false;
1814
+ const result = {
1815
+ type: "link",
1816
+ title: null,
1817
+ url: prefix + protocol + parts[0],
1818
+ children: [{ type: "text", value: protocol + parts[0] }]
1819
+ };
1820
+ if (parts[1]) {
1821
+ return [result, { type: "text", value: parts[1] }];
1822
+ }
1823
+ return result;
1824
+ }
1825
+ function findEmail(_, atext, label, match) {
1826
+ if (
1827
+ // Not an expected previous character.
1828
+ !previous(match, true) || // Label ends in not allowed character.
1829
+ /[-\d_]$/.test(label)
1830
+ ) {
1831
+ return false;
1832
+ }
1833
+ return {
1834
+ type: "link",
1835
+ title: null,
1836
+ url: "mailto:" + atext + "@" + label,
1837
+ children: [{ type: "text", value: atext + "@" + label }]
1838
+ };
1839
+ }
1840
+ function isCorrectDomain(domain2) {
1841
+ const parts = domain2.split(".");
1842
+ if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) {
1843
+ return false;
1844
+ }
1845
+ return true;
1846
+ }
1847
+ function splitUrl(url) {
1848
+ const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url);
1849
+ if (!trailExec) {
1850
+ return [url, void 0];
1851
+ }
1852
+ url = url.slice(0, trailExec.index);
1853
+ let trail2 = trailExec[0];
1854
+ let closingParenIndex = trail2.indexOf(")");
1855
+ const openingParens = ccount(url, "(");
1856
+ let closingParens = ccount(url, ")");
1857
+ while (closingParenIndex !== -1 && openingParens > closingParens) {
1858
+ url += trail2.slice(0, closingParenIndex + 1);
1859
+ trail2 = trail2.slice(closingParenIndex + 1);
1860
+ closingParenIndex = trail2.indexOf(")");
1861
+ closingParens++;
1862
+ }
1863
+ return [url, trail2];
1864
+ }
1865
+ function previous(match, email) {
1866
+ const code3 = match.input.charCodeAt(match.index - 1);
1867
+ return (match.index === 0 || unicodeWhitespace(code3) || unicodePunctuation(code3)) && // If it’s an email, the previous character should not be a slash.
1868
+ (!email || code3 !== 47);
1869
+ }
1870
+
1871
+ // ../../node_modules/.pnpm/micromark-util-normalize-identifier@2.0.1/node_modules/micromark-util-normalize-identifier/index.js
1872
+ function normalizeIdentifier(value) {
1873
+ return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
1874
+ }
1875
+
1876
+ // ../../node_modules/.pnpm/mdast-util-gfm-footnote@2.1.0/node_modules/mdast-util-gfm-footnote/lib/index.js
1877
+ footnoteReference.peek = footnoteReferencePeek;
1878
+ function enterFootnoteCallString() {
1879
+ this.buffer();
1880
+ }
1881
+ function enterFootnoteCall(token) {
1882
+ this.enter({ type: "footnoteReference", identifier: "", label: "" }, token);
1883
+ }
1884
+ function enterFootnoteDefinitionLabelString() {
1885
+ this.buffer();
1886
+ }
1887
+ function enterFootnoteDefinition(token) {
1888
+ this.enter(
1889
+ { type: "footnoteDefinition", identifier: "", label: "", children: [] },
1890
+ token
1891
+ );
1892
+ }
1893
+ function exitFootnoteCallString(token) {
1894
+ const label = this.resume();
1895
+ const node2 = this.stack[this.stack.length - 1];
1896
+ ok(node2.type === "footnoteReference");
1897
+ node2.identifier = normalizeIdentifier(
1898
+ this.sliceSerialize(token)
1899
+ ).toLowerCase();
1900
+ node2.label = label;
1901
+ }
1902
+ function exitFootnoteCall(token) {
1903
+ this.exit(token);
1904
+ }
1905
+ function exitFootnoteDefinitionLabelString(token) {
1906
+ const label = this.resume();
1907
+ const node2 = this.stack[this.stack.length - 1];
1908
+ ok(node2.type === "footnoteDefinition");
1909
+ node2.identifier = normalizeIdentifier(
1910
+ this.sliceSerialize(token)
1911
+ ).toLowerCase();
1912
+ node2.label = label;
1913
+ }
1914
+ function exitFootnoteDefinition(token) {
1915
+ this.exit(token);
1916
+ }
1917
+ function footnoteReferencePeek() {
1918
+ return "[";
1919
+ }
1920
+ function footnoteReference(node2, _, state, info) {
1921
+ const tracker = state.createTracker(info);
1922
+ let value = tracker.move("[^");
1923
+ const exit2 = state.enter("footnoteReference");
1924
+ const subexit = state.enter("reference");
1925
+ value += tracker.move(
1926
+ state.safe(state.associationId(node2), { after: "]", before: value })
1927
+ );
1928
+ subexit();
1929
+ exit2();
1930
+ value += tracker.move("]");
1931
+ return value;
1932
+ }
1933
+ function gfmFootnoteFromMarkdown() {
1934
+ return {
1935
+ enter: {
1936
+ gfmFootnoteCallString: enterFootnoteCallString,
1937
+ gfmFootnoteCall: enterFootnoteCall,
1938
+ gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,
1939
+ gfmFootnoteDefinition: enterFootnoteDefinition
1940
+ },
1941
+ exit: {
1942
+ gfmFootnoteCallString: exitFootnoteCallString,
1943
+ gfmFootnoteCall: exitFootnoteCall,
1944
+ gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,
1945
+ gfmFootnoteDefinition: exitFootnoteDefinition
1946
+ }
1947
+ };
1948
+ }
1949
+ function gfmFootnoteToMarkdown(options) {
1950
+ let firstLineBlank = false;
1951
+ if (options && options.firstLineBlank) {
1952
+ firstLineBlank = true;
1953
+ }
1954
+ return {
1955
+ handlers: { footnoteDefinition, footnoteReference },
1956
+ // This is on by default already.
1957
+ unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
1958
+ };
1959
+ function footnoteDefinition(node2, _, state, info) {
1960
+ const tracker = state.createTracker(info);
1961
+ let value = tracker.move("[^");
1962
+ const exit2 = state.enter("footnoteDefinition");
1963
+ const subexit = state.enter("label");
1964
+ value += tracker.move(
1965
+ state.safe(state.associationId(node2), { before: value, after: "]" })
1966
+ );
1967
+ subexit();
1968
+ value += tracker.move("]:");
1969
+ if (node2.children && node2.children.length > 0) {
1970
+ tracker.shift(4);
1971
+ value += tracker.move(
1972
+ (firstLineBlank ? "\n" : " ") + state.indentLines(
1973
+ state.containerFlow(node2, tracker.current()),
1974
+ firstLineBlank ? mapAll : mapExceptFirst
1975
+ )
1976
+ );
1977
+ }
1978
+ exit2();
1979
+ return value;
1980
+ }
1981
+ }
1982
+ function mapExceptFirst(line, index, blank) {
1983
+ return index === 0 ? line : mapAll(line, index, blank);
1984
+ }
1985
+ function mapAll(line, index, blank) {
1986
+ return (blank ? "" : " ") + line;
1987
+ }
1988
+
1989
+ // ../../node_modules/.pnpm/mdast-util-gfm-strikethrough@2.0.0/node_modules/mdast-util-gfm-strikethrough/lib/index.js
1990
+ var constructsWithoutStrikethrough = [
1991
+ "autolink",
1992
+ "destinationLiteral",
1993
+ "destinationRaw",
1994
+ "reference",
1995
+ "titleQuote",
1996
+ "titleApostrophe"
1997
+ ];
1998
+ handleDelete.peek = peekDelete;
1999
+ function gfmStrikethroughFromMarkdown() {
2000
+ return {
2001
+ canContainEols: ["delete"],
2002
+ enter: { strikethrough: enterStrikethrough },
2003
+ exit: { strikethrough: exitStrikethrough }
2004
+ };
2005
+ }
2006
+ function gfmStrikethroughToMarkdown() {
2007
+ return {
2008
+ unsafe: [
2009
+ {
2010
+ character: "~",
2011
+ inConstruct: "phrasing",
2012
+ notInConstruct: constructsWithoutStrikethrough
2013
+ }
2014
+ ],
2015
+ handlers: { delete: handleDelete }
2016
+ };
2017
+ }
2018
+ function enterStrikethrough(token) {
2019
+ this.enter({ type: "delete", children: [] }, token);
2020
+ }
2021
+ function exitStrikethrough(token) {
2022
+ this.exit(token);
2023
+ }
2024
+ function handleDelete(node2, _, state, info) {
2025
+ const tracker = state.createTracker(info);
2026
+ const exit2 = state.enter("strikethrough");
2027
+ let value = tracker.move("~~");
2028
+ value += state.containerPhrasing(node2, {
2029
+ ...tracker.current(),
2030
+ before: value,
2031
+ after: "~"
2032
+ });
2033
+ value += tracker.move("~~");
2034
+ exit2();
2035
+ return value;
2036
+ }
2037
+ function peekDelete() {
2038
+ return "~";
2039
+ }
2040
+
2041
+ // ../../node_modules/.pnpm/markdown-table@3.0.4/node_modules/markdown-table/index.js
2042
+ function defaultStringLength(value) {
2043
+ return value.length;
2044
+ }
2045
+ function markdownTable(table, options) {
2046
+ const settings = options || {};
2047
+ const align = (settings.align || []).concat();
2048
+ const stringLength = settings.stringLength || defaultStringLength;
2049
+ const alignments = [];
2050
+ const cellMatrix = [];
2051
+ const sizeMatrix = [];
2052
+ const longestCellByColumn = [];
2053
+ let mostCellsPerRow = 0;
2054
+ let rowIndex = -1;
2055
+ while (++rowIndex < table.length) {
2056
+ const row2 = [];
2057
+ const sizes2 = [];
2058
+ let columnIndex2 = -1;
2059
+ if (table[rowIndex].length > mostCellsPerRow) {
2060
+ mostCellsPerRow = table[rowIndex].length;
2061
+ }
2062
+ while (++columnIndex2 < table[rowIndex].length) {
2063
+ const cell = serialize(table[rowIndex][columnIndex2]);
2064
+ if (settings.alignDelimiters !== false) {
2065
+ const size = stringLength(cell);
2066
+ sizes2[columnIndex2] = size;
2067
+ if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
2068
+ longestCellByColumn[columnIndex2] = size;
2069
+ }
2070
+ }
2071
+ row2.push(cell);
2072
+ }
2073
+ cellMatrix[rowIndex] = row2;
2074
+ sizeMatrix[rowIndex] = sizes2;
2075
+ }
2076
+ let columnIndex = -1;
2077
+ if (typeof align === "object" && "length" in align) {
2078
+ while (++columnIndex < mostCellsPerRow) {
2079
+ alignments[columnIndex] = toAlignment(align[columnIndex]);
2080
+ }
2081
+ } else {
2082
+ const code3 = toAlignment(align);
2083
+ while (++columnIndex < mostCellsPerRow) {
2084
+ alignments[columnIndex] = code3;
2085
+ }
2086
+ }
2087
+ columnIndex = -1;
2088
+ const row = [];
2089
+ const sizes = [];
2090
+ while (++columnIndex < mostCellsPerRow) {
2091
+ const code3 = alignments[columnIndex];
2092
+ let before = "";
2093
+ let after = "";
2094
+ if (code3 === 99) {
2095
+ before = ":";
2096
+ after = ":";
2097
+ } else if (code3 === 108) {
2098
+ before = ":";
2099
+ } else if (code3 === 114) {
2100
+ after = ":";
2101
+ }
2102
+ let size = settings.alignDelimiters === false ? 1 : Math.max(
2103
+ 1,
2104
+ longestCellByColumn[columnIndex] - before.length - after.length
2105
+ );
2106
+ const cell = before + "-".repeat(size) + after;
2107
+ if (settings.alignDelimiters !== false) {
2108
+ size = before.length + size + after.length;
2109
+ if (size > longestCellByColumn[columnIndex]) {
2110
+ longestCellByColumn[columnIndex] = size;
2111
+ }
2112
+ sizes[columnIndex] = size;
2113
+ }
2114
+ row[columnIndex] = cell;
2115
+ }
2116
+ cellMatrix.splice(1, 0, row);
2117
+ sizeMatrix.splice(1, 0, sizes);
2118
+ rowIndex = -1;
2119
+ const lines = [];
2120
+ while (++rowIndex < cellMatrix.length) {
2121
+ const row2 = cellMatrix[rowIndex];
2122
+ const sizes2 = sizeMatrix[rowIndex];
2123
+ columnIndex = -1;
2124
+ const line = [];
2125
+ while (++columnIndex < mostCellsPerRow) {
2126
+ const cell = row2[columnIndex] || "";
2127
+ let before = "";
2128
+ let after = "";
2129
+ if (settings.alignDelimiters !== false) {
2130
+ const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
2131
+ const code3 = alignments[columnIndex];
2132
+ if (code3 === 114) {
2133
+ before = " ".repeat(size);
2134
+ } else if (code3 === 99) {
2135
+ if (size % 2) {
2136
+ before = " ".repeat(size / 2 + 0.5);
2137
+ after = " ".repeat(size / 2 - 0.5);
2138
+ } else {
2139
+ before = " ".repeat(size / 2);
2140
+ after = before;
2141
+ }
2142
+ } else {
2143
+ after = " ".repeat(size);
2144
+ }
2145
+ }
2146
+ if (settings.delimiterStart !== false && !columnIndex) {
2147
+ line.push("|");
2148
+ }
2149
+ if (settings.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is
2150
+ // empty: there will be a closing space.
2151
+ !(settings.alignDelimiters === false && cell === "") && (settings.delimiterStart !== false || columnIndex)) {
2152
+ line.push(" ");
2153
+ }
2154
+ if (settings.alignDelimiters !== false) {
2155
+ line.push(before);
2156
+ }
2157
+ line.push(cell);
2158
+ if (settings.alignDelimiters !== false) {
2159
+ line.push(after);
2160
+ }
2161
+ if (settings.padding !== false) {
2162
+ line.push(" ");
2163
+ }
2164
+ if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
2165
+ line.push("|");
2166
+ }
2167
+ }
2168
+ lines.push(
2169
+ settings.delimiterEnd === false ? line.join("").replace(/ +$/, "") : line.join("")
2170
+ );
2171
+ }
2172
+ return lines.join("\n");
2173
+ }
2174
+ function serialize(value) {
2175
+ return value === null || value === void 0 ? "" : String(value);
2176
+ }
2177
+ function toAlignment(value) {
2178
+ const code3 = typeof value === "string" ? value.codePointAt(0) : 0;
2179
+ return code3 === 67 || code3 === 99 ? 99 : code3 === 76 || code3 === 108 ? 108 : code3 === 82 || code3 === 114 ? 114 : 0;
2180
+ }
2181
+
2182
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
2183
+ function blockquote(node2, _, state, info) {
2184
+ const exit2 = state.enter("blockquote");
2185
+ const tracker = state.createTracker(info);
2186
+ tracker.move("> ");
2187
+ tracker.shift(2);
2188
+ const value = state.indentLines(
2189
+ state.containerFlow(node2, tracker.current()),
2190
+ map
2191
+ );
2192
+ exit2();
2193
+ return value;
2194
+ }
2195
+ function map(line, _, blank) {
2196
+ return ">" + (blank ? "" : " ") + line;
2197
+ }
2198
+
2199
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
2200
+ function patternInScope(stack, pattern) {
2201
+ return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
2202
+ }
2203
+ function listInScope(stack, list2, none) {
2204
+ if (typeof list2 === "string") {
2205
+ list2 = [list2];
2206
+ }
2207
+ if (!list2 || list2.length === 0) {
2208
+ return none;
2209
+ }
2210
+ let index = -1;
2211
+ while (++index < list2.length) {
2212
+ if (stack.includes(list2[index])) {
2213
+ return true;
2214
+ }
2215
+ }
2216
+ return false;
2217
+ }
2218
+
2219
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/break.js
2220
+ function hardBreak(_, _1, state, info) {
2221
+ let index = -1;
2222
+ while (++index < state.unsafe.length) {
2223
+ if (state.unsafe[index].character === "\n" && patternInScope(state.stack, state.unsafe[index])) {
2224
+ return /[ \t]/.test(info.before) ? "" : " ";
2225
+ }
2226
+ }
2227
+ return "\\\n";
2228
+ }
2229
+
2230
+ // ../../node_modules/.pnpm/longest-streak@3.1.0/node_modules/longest-streak/index.js
2231
+ function longestStreak(value, substring) {
2232
+ const source = String(value);
2233
+ let index = source.indexOf(substring);
2234
+ let expected = index;
2235
+ let count = 0;
2236
+ let max = 0;
2237
+ if (typeof substring !== "string") {
2238
+ throw new TypeError("Expected substring");
2239
+ }
2240
+ while (index !== -1) {
2241
+ if (index === expected) {
2242
+ if (++count > max) {
2243
+ max = count;
2244
+ }
2245
+ } else {
2246
+ count = 1;
2247
+ }
2248
+ expected = index + substring.length;
2249
+ index = source.indexOf(substring, expected);
2250
+ }
2251
+ return max;
2252
+ }
2253
+
2254
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
2255
+ function formatCodeAsIndented(node2, state) {
2256
+ return Boolean(
2257
+ state.options.fences === false && node2.value && // If there’s no info…
2258
+ !node2.lang && // And there’s a non-whitespace character…
2259
+ /[^ \r\n]/.test(node2.value) && // And the value doesn’t start or end in a blank…
2260
+ !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value)
2261
+ );
2262
+ }
2263
+
2264
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-fence.js
2265
+ function checkFence(state) {
2266
+ const marker = state.options.fence || "`";
2267
+ if (marker !== "`" && marker !== "~") {
2268
+ throw new Error(
2269
+ "Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`"
2270
+ );
2271
+ }
2272
+ return marker;
2273
+ }
2274
+
2275
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/code.js
2276
+ function code(node2, _, state, info) {
2277
+ const marker = checkFence(state);
2278
+ const raw = node2.value || "";
2279
+ const suffix = marker === "`" ? "GraveAccent" : "Tilde";
2280
+ if (formatCodeAsIndented(node2, state)) {
2281
+ const exit3 = state.enter("codeIndented");
2282
+ const value2 = state.indentLines(raw, map2);
2283
+ exit3();
2284
+ return value2;
2285
+ }
2286
+ const tracker = state.createTracker(info);
2287
+ const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
2288
+ const exit2 = state.enter("codeFenced");
2289
+ let value = tracker.move(sequence);
2290
+ if (node2.lang) {
2291
+ const subexit = state.enter(`codeFencedLang${suffix}`);
2292
+ value += tracker.move(
2293
+ state.safe(node2.lang, {
2294
+ before: value,
2295
+ after: " ",
2296
+ encode: ["`"],
2297
+ ...tracker.current()
2298
+ })
2299
+ );
2300
+ subexit();
2301
+ }
2302
+ if (node2.lang && node2.meta) {
2303
+ const subexit = state.enter(`codeFencedMeta${suffix}`);
2304
+ value += tracker.move(" ");
2305
+ value += tracker.move(
2306
+ state.safe(node2.meta, {
2307
+ before: value,
2308
+ after: "\n",
2309
+ encode: ["`"],
2310
+ ...tracker.current()
2311
+ })
2312
+ );
2313
+ subexit();
2314
+ }
2315
+ value += tracker.move("\n");
2316
+ if (raw) {
2317
+ value += tracker.move(raw + "\n");
2318
+ }
2319
+ value += tracker.move(sequence);
2320
+ exit2();
2321
+ return value;
2322
+ }
2323
+ function map2(line, _, blank) {
2324
+ return (blank ? "" : " ") + line;
2325
+ }
2326
+
2327
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-quote.js
2328
+ function checkQuote(state) {
2329
+ const marker = state.options.quote || '"';
2330
+ if (marker !== '"' && marker !== "'") {
2331
+ throw new Error(
2332
+ "Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`"
2333
+ );
2334
+ }
2335
+ return marker;
2336
+ }
2337
+
2338
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/definition.js
2339
+ function definition(node2, _, state, info) {
2340
+ const quote = checkQuote(state);
2341
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
2342
+ const exit2 = state.enter("definition");
2343
+ let subexit = state.enter("label");
2344
+ const tracker = state.createTracker(info);
2345
+ let value = tracker.move("[");
2346
+ value += tracker.move(
2347
+ state.safe(state.associationId(node2), {
2348
+ before: value,
2349
+ after: "]",
2350
+ ...tracker.current()
2351
+ })
2352
+ );
2353
+ value += tracker.move("]: ");
2354
+ subexit();
2355
+ if (
2356
+ // If there’s no url, or…
2357
+ !node2.url || // If there are control characters or whitespace.
2358
+ /[\0- \u007F]/.test(node2.url)
2359
+ ) {
2360
+ subexit = state.enter("destinationLiteral");
2361
+ value += tracker.move("<");
2362
+ value += tracker.move(
2363
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
2364
+ );
2365
+ value += tracker.move(">");
2366
+ } else {
2367
+ subexit = state.enter("destinationRaw");
2368
+ value += tracker.move(
2369
+ state.safe(node2.url, {
2370
+ before: value,
2371
+ after: node2.title ? " " : "\n",
2372
+ ...tracker.current()
2373
+ })
2374
+ );
2375
+ }
2376
+ subexit();
2377
+ if (node2.title) {
2378
+ subexit = state.enter(`title${suffix}`);
2379
+ value += tracker.move(" " + quote);
2380
+ value += tracker.move(
2381
+ state.safe(node2.title, {
2382
+ before: value,
2383
+ after: quote,
2384
+ ...tracker.current()
2385
+ })
2386
+ );
2387
+ value += tracker.move(quote);
2388
+ subexit();
2389
+ }
2390
+ exit2();
2391
+ return value;
2392
+ }
2393
+
2394
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
2395
+ function checkEmphasis(state) {
2396
+ const marker = state.options.emphasis || "*";
2397
+ if (marker !== "*" && marker !== "_") {
2398
+ throw new Error(
2399
+ "Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`"
2400
+ );
2401
+ }
2402
+ return marker;
2403
+ }
2404
+
2405
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
2406
+ function encodeCharacterReference(code3) {
2407
+ return "&#x" + code3.toString(16).toUpperCase() + ";";
2408
+ }
2409
+
2410
+ // ../../node_modules/.pnpm/micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.js
2411
+ function classifyCharacter(code3) {
2412
+ if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
2413
+ return 1;
2414
+ }
2415
+ if (unicodePunctuation(code3)) {
2416
+ return 2;
2417
+ }
2418
+ }
2419
+
2420
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-info.js
2421
+ function encodeInfo(outside, inside, marker) {
2422
+ const outsideKind = classifyCharacter(outside);
2423
+ const insideKind = classifyCharacter(inside);
2424
+ if (outsideKind === void 0) {
2425
+ return insideKind === void 0 ? (
2426
+ // Letter inside:
2427
+ // we have to encode *both* letters for `_` as it is looser.
2428
+ // it already forms for `*` (and GFMs `~`).
2429
+ marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false }
2430
+ ) : insideKind === 1 ? (
2431
+ // Whitespace inside: encode both (letter, whitespace).
2432
+ { inside: true, outside: true }
2433
+ ) : (
2434
+ // Punctuation inside: encode outer (letter)
2435
+ { inside: false, outside: true }
2436
+ );
2437
+ }
2438
+ if (outsideKind === 1) {
2439
+ return insideKind === void 0 ? (
2440
+ // Letter inside: already forms.
2441
+ { inside: false, outside: false }
2442
+ ) : insideKind === 1 ? (
2443
+ // Whitespace inside: encode both (whitespace).
2444
+ { inside: true, outside: true }
2445
+ ) : (
2446
+ // Punctuation inside: already forms.
2447
+ { inside: false, outside: false }
2448
+ );
2449
+ }
2450
+ return insideKind === void 0 ? (
2451
+ // Letter inside: already forms.
2452
+ { inside: false, outside: false }
2453
+ ) : insideKind === 1 ? (
2454
+ // Whitespace inside: encode inner (whitespace).
2455
+ { inside: true, outside: false }
2456
+ ) : (
2457
+ // Punctuation inside: already forms.
2458
+ { inside: false, outside: false }
2459
+ );
2460
+ }
2461
+
2462
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
2463
+ emphasis.peek = emphasisPeek;
2464
+ function emphasis(node2, _, state, info) {
2465
+ const marker = checkEmphasis(state);
2466
+ const exit2 = state.enter("emphasis");
2467
+ const tracker = state.createTracker(info);
2468
+ const before = tracker.move(marker);
2469
+ let between = tracker.move(
2470
+ state.containerPhrasing(node2, {
2471
+ after: marker,
2472
+ before,
2473
+ ...tracker.current()
2474
+ })
2475
+ );
2476
+ const betweenHead = between.charCodeAt(0);
2477
+ const open = encodeInfo(
2478
+ info.before.charCodeAt(info.before.length - 1),
2479
+ betweenHead,
2480
+ marker
2481
+ );
2482
+ if (open.inside) {
2483
+ between = encodeCharacterReference(betweenHead) + between.slice(1);
2484
+ }
2485
+ const betweenTail = between.charCodeAt(between.length - 1);
2486
+ const close2 = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
2487
+ if (close2.inside) {
2488
+ between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
2489
+ }
2490
+ const after = tracker.move(marker);
2491
+ exit2();
2492
+ state.attentionEncodeSurroundingInfo = {
2493
+ after: close2.outside,
2494
+ before: open.outside
2495
+ };
2496
+ return before + between + after;
2497
+ }
2498
+ function emphasisPeek(_, _1, state) {
2499
+ return state.options.emphasis || "*";
2500
+ }
2501
+
2502
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
2503
+ var import_unist_util_visit = require("unist-util-visit");
2504
+
2505
+ // ../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js
2506
+ var emptyOptions = {};
2507
+ function toString(value, options) {
2508
+ const settings = options || emptyOptions;
2509
+ const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
2510
+ const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
2511
+ return one(value, includeImageAlt, includeHtml);
2512
+ }
2513
+ function one(value, includeImageAlt, includeHtml) {
2514
+ if (node(value)) {
2515
+ if ("value" in value) {
2516
+ return value.type === "html" && !includeHtml ? "" : value.value;
2517
+ }
2518
+ if (includeImageAlt && "alt" in value && value.alt) {
2519
+ return value.alt;
2520
+ }
2521
+ if ("children" in value) {
2522
+ return all(value.children, includeImageAlt, includeHtml);
2523
+ }
2524
+ }
2525
+ if (Array.isArray(value)) {
2526
+ return all(value, includeImageAlt, includeHtml);
2527
+ }
2528
+ return "";
2529
+ }
2530
+ function all(values, includeImageAlt, includeHtml) {
2531
+ const result = [];
2532
+ let index = -1;
2533
+ while (++index < values.length) {
2534
+ result[index] = one(values[index], includeImageAlt, includeHtml);
2535
+ }
2536
+ return result.join("");
2537
+ }
2538
+ function node(value) {
2539
+ return Boolean(value && typeof value === "object");
2540
+ }
2541
+
2542
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
2543
+ function formatHeadingAsSetext(node2, state) {
2544
+ let literalWithBreak = false;
2545
+ (0, import_unist_util_visit.visit)(node2, function(node3) {
2546
+ if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") {
2547
+ literalWithBreak = true;
2548
+ return import_unist_util_visit.EXIT;
2549
+ }
2550
+ });
2551
+ return Boolean(
2552
+ (!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)
2553
+ );
2554
+ }
2555
+
2556
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/heading.js
2557
+ function heading(node2, _, state, info) {
2558
+ const rank = Math.max(Math.min(6, node2.depth || 1), 1);
2559
+ const tracker = state.createTracker(info);
2560
+ if (formatHeadingAsSetext(node2, state)) {
2561
+ const exit3 = state.enter("headingSetext");
2562
+ const subexit2 = state.enter("phrasing");
2563
+ const value2 = state.containerPhrasing(node2, {
2564
+ ...tracker.current(),
2565
+ before: "\n",
2566
+ after: "\n"
2567
+ });
2568
+ subexit2();
2569
+ exit3();
2570
+ return value2 + "\n" + (rank === 1 ? "=" : "-").repeat(
2571
+ // The whole size…
2572
+ value2.length - // Minus the position of the character after the last EOL (or
2573
+ // 0 if there is none)…
2574
+ (Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1)
2575
+ );
2576
+ }
2577
+ const sequence = "#".repeat(rank);
2578
+ const exit2 = state.enter("headingAtx");
2579
+ const subexit = state.enter("phrasing");
2580
+ tracker.move(sequence + " ");
2581
+ let value = state.containerPhrasing(node2, {
2582
+ before: "# ",
2583
+ after: "\n",
2584
+ ...tracker.current()
2585
+ });
2586
+ if (/^[\t ]/.test(value)) {
2587
+ value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
2588
+ }
2589
+ value = value ? sequence + " " + value : sequence;
2590
+ if (state.options.closeAtx) {
2591
+ value += " " + sequence;
2592
+ }
2593
+ subexit();
2594
+ exit2();
2595
+ return value;
2596
+ }
2597
+
2598
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/html.js
2599
+ html.peek = htmlPeek;
2600
+ function html(node2) {
2601
+ return node2.value || "";
2602
+ }
2603
+ function htmlPeek() {
2604
+ return "<";
2605
+ }
2606
+
2607
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image.js
2608
+ image.peek = imagePeek;
2609
+ function image(node2, _, state, info) {
2610
+ const quote = checkQuote(state);
2611
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
2612
+ const exit2 = state.enter("image");
2613
+ let subexit = state.enter("label");
2614
+ const tracker = state.createTracker(info);
2615
+ let value = tracker.move("![");
2616
+ value += tracker.move(
2617
+ state.safe(node2.alt, { before: value, after: "]", ...tracker.current() })
2618
+ );
2619
+ value += tracker.move("](");
2620
+ subexit();
2621
+ if (
2622
+ // If there’s no url but there is a title…
2623
+ !node2.url && node2.title || // If there are control characters or whitespace.
2624
+ /[\0- \u007F]/.test(node2.url)
2625
+ ) {
2626
+ subexit = state.enter("destinationLiteral");
2627
+ value += tracker.move("<");
2628
+ value += tracker.move(
2629
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
2630
+ );
2631
+ value += tracker.move(">");
2632
+ } else {
2633
+ subexit = state.enter("destinationRaw");
2634
+ value += tracker.move(
2635
+ state.safe(node2.url, {
2636
+ before: value,
2637
+ after: node2.title ? " " : ")",
2638
+ ...tracker.current()
2639
+ })
2640
+ );
2641
+ }
2642
+ subexit();
2643
+ if (node2.title) {
2644
+ subexit = state.enter(`title${suffix}`);
2645
+ value += tracker.move(" " + quote);
2646
+ value += tracker.move(
2647
+ state.safe(node2.title, {
2648
+ before: value,
2649
+ after: quote,
2650
+ ...tracker.current()
2651
+ })
2652
+ );
2653
+ value += tracker.move(quote);
2654
+ subexit();
2655
+ }
2656
+ value += tracker.move(")");
2657
+ exit2();
2658
+ return value;
2659
+ }
2660
+ function imagePeek() {
2661
+ return "!";
2662
+ }
2663
+
2664
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
2665
+ imageReference.peek = imageReferencePeek;
2666
+ function imageReference(node2, _, state, info) {
2667
+ const type = node2.referenceType;
2668
+ const exit2 = state.enter("imageReference");
2669
+ let subexit = state.enter("label");
2670
+ const tracker = state.createTracker(info);
2671
+ let value = tracker.move("![");
2672
+ const alt = state.safe(node2.alt, {
2673
+ before: value,
2674
+ after: "]",
2675
+ ...tracker.current()
2676
+ });
2677
+ value += tracker.move(alt + "][");
2678
+ subexit();
2679
+ const stack = state.stack;
2680
+ state.stack = [];
2681
+ subexit = state.enter("reference");
2682
+ const reference = state.safe(state.associationId(node2), {
2683
+ before: value,
2684
+ after: "]",
2685
+ ...tracker.current()
2686
+ });
2687
+ subexit();
2688
+ state.stack = stack;
2689
+ exit2();
2690
+ if (type === "full" || !alt || alt !== reference) {
2691
+ value += tracker.move(reference + "]");
2692
+ } else if (type === "shortcut") {
2693
+ value = value.slice(0, -1);
2694
+ } else {
2695
+ value += tracker.move("]");
2696
+ }
2697
+ return value;
2698
+ }
2699
+ function imageReferencePeek() {
2700
+ return "!";
2701
+ }
2702
+
2703
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
2704
+ inlineCode.peek = inlineCodePeek;
2705
+ function inlineCode(node2, _, state) {
2706
+ let value = node2.value || "";
2707
+ let sequence = "`";
2708
+ let index = -1;
2709
+ while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
2710
+ sequence += "`";
2711
+ }
2712
+ if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
2713
+ value = " " + value + " ";
2714
+ }
2715
+ while (++index < state.unsafe.length) {
2716
+ const pattern = state.unsafe[index];
2717
+ const expression = state.compilePattern(pattern);
2718
+ let match;
2719
+ if (!pattern.atBreak) continue;
2720
+ while (match = expression.exec(value)) {
2721
+ let position = match.index;
2722
+ if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
2723
+ position--;
2724
+ }
2725
+ value = value.slice(0, position) + " " + value.slice(match.index + 1);
2726
+ }
2727
+ }
2728
+ return sequence + value + sequence;
2729
+ }
2730
+ function inlineCodePeek() {
2731
+ return "`";
2732
+ }
2733
+
2734
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
2735
+ function formatLinkAsAutolink(node2, state) {
2736
+ const raw = toString(node2);
2737
+ return Boolean(
2738
+ !state.options.resourceLink && // If there’s a url…
2739
+ node2.url && // And there’s a no title…
2740
+ !node2.title && // And the content of `node` is a single text node…
2741
+ node2.children && node2.children.length === 1 && node2.children[0].type === "text" && // And if the url is the same as the content…
2742
+ (raw === node2.url || "mailto:" + raw === node2.url) && // And that starts w/ a protocol…
2743
+ /^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and
2744
+ // references don’t work), space, or angle brackets…
2745
+ !/[\0- <>\u007F]/.test(node2.url)
2746
+ );
2747
+ }
2748
+
2749
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link.js
2750
+ link.peek = linkPeek;
2751
+ function link(node2, _, state, info) {
2752
+ const quote = checkQuote(state);
2753
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
2754
+ const tracker = state.createTracker(info);
2755
+ let exit2;
2756
+ let subexit;
2757
+ if (formatLinkAsAutolink(node2, state)) {
2758
+ const stack = state.stack;
2759
+ state.stack = [];
2760
+ exit2 = state.enter("autolink");
2761
+ let value2 = tracker.move("<");
2762
+ value2 += tracker.move(
2763
+ state.containerPhrasing(node2, {
2764
+ before: value2,
2765
+ after: ">",
2766
+ ...tracker.current()
2767
+ })
2768
+ );
2769
+ value2 += tracker.move(">");
2770
+ exit2();
2771
+ state.stack = stack;
2772
+ return value2;
2773
+ }
2774
+ exit2 = state.enter("link");
2775
+ subexit = state.enter("label");
2776
+ let value = tracker.move("[");
2777
+ value += tracker.move(
2778
+ state.containerPhrasing(node2, {
2779
+ before: value,
2780
+ after: "](",
2781
+ ...tracker.current()
2782
+ })
2783
+ );
2784
+ value += tracker.move("](");
2785
+ subexit();
2786
+ if (
2787
+ // If there’s no url but there is a title…
2788
+ !node2.url && node2.title || // If there are control characters or whitespace.
2789
+ /[\0- \u007F]/.test(node2.url)
2790
+ ) {
2791
+ subexit = state.enter("destinationLiteral");
2792
+ value += tracker.move("<");
2793
+ value += tracker.move(
2794
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
2795
+ );
2796
+ value += tracker.move(">");
2797
+ } else {
2798
+ subexit = state.enter("destinationRaw");
2799
+ value += tracker.move(
2800
+ state.safe(node2.url, {
2801
+ before: value,
2802
+ after: node2.title ? " " : ")",
2803
+ ...tracker.current()
2804
+ })
2805
+ );
2806
+ }
2807
+ subexit();
2808
+ if (node2.title) {
2809
+ subexit = state.enter(`title${suffix}`);
2810
+ value += tracker.move(" " + quote);
2811
+ value += tracker.move(
2812
+ state.safe(node2.title, {
2813
+ before: value,
2814
+ after: quote,
2815
+ ...tracker.current()
2816
+ })
2817
+ );
2818
+ value += tracker.move(quote);
2819
+ subexit();
2820
+ }
2821
+ value += tracker.move(")");
2822
+ exit2();
2823
+ return value;
2824
+ }
2825
+ function linkPeek(node2, _, state) {
2826
+ return formatLinkAsAutolink(node2, state) ? "<" : "[";
2827
+ }
2828
+
2829
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
2830
+ linkReference.peek = linkReferencePeek;
2831
+ function linkReference(node2, _, state, info) {
2832
+ const type = node2.referenceType;
2833
+ const exit2 = state.enter("linkReference");
2834
+ let subexit = state.enter("label");
2835
+ const tracker = state.createTracker(info);
2836
+ let value = tracker.move("[");
2837
+ const text3 = state.containerPhrasing(node2, {
2838
+ before: value,
2839
+ after: "]",
2840
+ ...tracker.current()
2841
+ });
2842
+ value += tracker.move(text3 + "][");
2843
+ subexit();
2844
+ const stack = state.stack;
2845
+ state.stack = [];
2846
+ subexit = state.enter("reference");
2847
+ const reference = state.safe(state.associationId(node2), {
2848
+ before: value,
2849
+ after: "]",
2850
+ ...tracker.current()
2851
+ });
2852
+ subexit();
2853
+ state.stack = stack;
2854
+ exit2();
2855
+ if (type === "full" || !text3 || text3 !== reference) {
2856
+ value += tracker.move(reference + "]");
2857
+ } else if (type === "shortcut") {
2858
+ value = value.slice(0, -1);
2859
+ } else {
2860
+ value += tracker.move("]");
2861
+ }
2862
+ return value;
2863
+ }
2864
+ function linkReferencePeek() {
2865
+ return "[";
2866
+ }
2867
+
2868
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
2869
+ function checkBullet(state) {
2870
+ const marker = state.options.bullet || "*";
2871
+ if (marker !== "*" && marker !== "+" && marker !== "-") {
2872
+ throw new Error(
2873
+ "Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`"
2874
+ );
2875
+ }
2876
+ return marker;
2877
+ }
2878
+
2879
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
2880
+ function checkBulletOther(state) {
2881
+ const bullet = checkBullet(state);
2882
+ const bulletOther = state.options.bulletOther;
2883
+ if (!bulletOther) {
2884
+ return bullet === "*" ? "-" : "*";
2885
+ }
2886
+ if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") {
2887
+ throw new Error(
2888
+ "Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
2889
+ );
2890
+ }
2891
+ if (bulletOther === bullet) {
2892
+ throw new Error(
2893
+ "Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different"
2894
+ );
2895
+ }
2896
+ return bulletOther;
2897
+ }
2898
+
2899
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
2900
+ function checkBulletOrdered(state) {
2901
+ const marker = state.options.bulletOrdered || ".";
2902
+ if (marker !== "." && marker !== ")") {
2903
+ throw new Error(
2904
+ "Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`"
2905
+ );
2906
+ }
2907
+ return marker;
2908
+ }
2909
+
2910
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule.js
2911
+ function checkRule(state) {
2912
+ const marker = state.options.rule || "*";
2913
+ if (marker !== "*" && marker !== "-" && marker !== "_") {
2914
+ throw new Error(
2915
+ "Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`"
2916
+ );
2917
+ }
2918
+ return marker;
2919
+ }
2920
+
2921
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list.js
2922
+ function list(node2, parent, state, info) {
2923
+ const exit2 = state.enter("list");
2924
+ const bulletCurrent = state.bulletCurrent;
2925
+ let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);
2926
+ const bulletOther = node2.ordered ? bullet === "." ? ")" : "." : checkBulletOther(state);
2927
+ let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;
2928
+ if (!node2.ordered) {
2929
+ const firstListItem = node2.children ? node2.children[0] : void 0;
2930
+ if (
2931
+ // Bullet could be used as a thematic break marker:
2932
+ (bullet === "*" || bullet === "-") && // Empty first list item:
2933
+ firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:
2934
+ state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && // That are each the first child.
2935
+ state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0
2936
+ ) {
2937
+ useDifferentMarker = true;
2938
+ }
2939
+ if (checkRule(state) === bullet && firstListItem) {
2940
+ let index = -1;
2941
+ while (++index < node2.children.length) {
2942
+ const item = node2.children[index];
2943
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
2944
+ useDifferentMarker = true;
2945
+ break;
2946
+ }
2947
+ }
2948
+ }
2949
+ }
2950
+ if (useDifferentMarker) {
2951
+ bullet = bulletOther;
2952
+ }
2953
+ state.bulletCurrent = bullet;
2954
+ const value = state.containerFlow(node2, info);
2955
+ state.bulletLastUsed = bullet;
2956
+ state.bulletCurrent = bulletCurrent;
2957
+ exit2();
2958
+ return value;
2959
+ }
2960
+
2961
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
2962
+ function checkListItemIndent(state) {
2963
+ const style = state.options.listItemIndent || "one";
2964
+ if (style !== "tab" && style !== "one" && style !== "mixed") {
2965
+ throw new Error(
2966
+ "Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
2967
+ );
2968
+ }
2969
+ return style;
2970
+ }
2971
+
2972
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list-item.js
2973
+ function listItem(node2, parent, state, info) {
2974
+ const listItemIndent = checkListItemIndent(state);
2975
+ let bullet = state.bulletCurrent || checkBullet(state);
2976
+ if (parent && parent.type === "list" && parent.ordered) {
2977
+ bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;
2978
+ }
2979
+ let size = bullet.length + 1;
2980
+ if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) {
2981
+ size = Math.ceil(size / 4) * 4;
2982
+ }
2983
+ const tracker = state.createTracker(info);
2984
+ tracker.move(bullet + " ".repeat(size - bullet.length));
2985
+ tracker.shift(size);
2986
+ const exit2 = state.enter("listItem");
2987
+ const value = state.indentLines(
2988
+ state.containerFlow(node2, tracker.current()),
2989
+ map3
2990
+ );
2991
+ exit2();
2992
+ return value;
2993
+ function map3(line, index, blank) {
2994
+ if (index) {
2995
+ return (blank ? "" : " ".repeat(size)) + line;
2996
+ }
2997
+ return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
2998
+ }
2999
+ }
3000
+
3001
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
3002
+ function paragraph(node2, _, state, info) {
3003
+ const exit2 = state.enter("paragraph");
3004
+ const subexit = state.enter("phrasing");
3005
+ const value = state.containerPhrasing(node2, info);
3006
+ subexit();
3007
+ exit2();
3008
+ return value;
3009
+ }
3010
+
3011
+ // ../../node_modules/.pnpm/mdast-util-phrasing@4.1.0/node_modules/mdast-util-phrasing/lib/index.js
3012
+ var phrasing = (
3013
+ /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
3014
+ convert([
3015
+ "break",
3016
+ "delete",
3017
+ "emphasis",
3018
+ // To do: next major: removed since footnotes were added to GFM.
3019
+ "footnote",
3020
+ "footnoteReference",
3021
+ "image",
3022
+ "imageReference",
3023
+ "inlineCode",
3024
+ // Enabled by `mdast-util-math`:
3025
+ "inlineMath",
3026
+ "link",
3027
+ "linkReference",
3028
+ // Enabled by `mdast-util-mdx`:
3029
+ "mdxJsxTextElement",
3030
+ // Enabled by `mdast-util-mdx`:
3031
+ "mdxTextExpression",
3032
+ "strong",
3033
+ "text",
3034
+ // Enabled by `mdast-util-directive`:
3035
+ "textDirective"
3036
+ ])
3037
+ );
3038
+
3039
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/root.js
3040
+ function root(node2, _, state, info) {
3041
+ const hasPhrasing = node2.children.some(function(d) {
3042
+ return phrasing(d);
3043
+ });
3044
+ const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;
3045
+ return container.call(state, node2, info);
3046
+ }
3047
+
3048
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-strong.js
3049
+ function checkStrong(state) {
3050
+ const marker = state.options.strong || "*";
3051
+ if (marker !== "*" && marker !== "_") {
3052
+ throw new Error(
3053
+ "Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`"
3054
+ );
3055
+ }
3056
+ return marker;
3057
+ }
3058
+
3059
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/strong.js
3060
+ strong.peek = strongPeek;
3061
+ function strong(node2, _, state, info) {
3062
+ const marker = checkStrong(state);
3063
+ const exit2 = state.enter("strong");
3064
+ const tracker = state.createTracker(info);
3065
+ const before = tracker.move(marker + marker);
3066
+ let between = tracker.move(
3067
+ state.containerPhrasing(node2, {
3068
+ after: marker,
3069
+ before,
3070
+ ...tracker.current()
3071
+ })
3072
+ );
3073
+ const betweenHead = between.charCodeAt(0);
3074
+ const open = encodeInfo(
3075
+ info.before.charCodeAt(info.before.length - 1),
3076
+ betweenHead,
3077
+ marker
3078
+ );
3079
+ if (open.inside) {
3080
+ between = encodeCharacterReference(betweenHead) + between.slice(1);
3081
+ }
3082
+ const betweenTail = between.charCodeAt(between.length - 1);
3083
+ const close2 = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
3084
+ if (close2.inside) {
3085
+ between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
3086
+ }
3087
+ const after = tracker.move(marker + marker);
3088
+ exit2();
3089
+ state.attentionEncodeSurroundingInfo = {
3090
+ after: close2.outside,
3091
+ before: open.outside
3092
+ };
3093
+ return before + between + after;
3094
+ }
3095
+ function strongPeek(_, _1, state) {
3096
+ return state.options.strong || "*";
3097
+ }
3098
+
3099
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/text.js
3100
+ function text(node2, _, state, info) {
3101
+ return state.safe(node2.value, info);
3102
+ }
3103
+
3104
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
3105
+ function checkRuleRepetition(state) {
3106
+ const repetition = state.options.ruleRepetition || 3;
3107
+ if (repetition < 3) {
3108
+ throw new Error(
3109
+ "Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more"
3110
+ );
3111
+ }
3112
+ return repetition;
3113
+ }
3114
+
3115
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
3116
+ function thematicBreak(_, _1, state) {
3117
+ const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
3118
+ return state.options.ruleSpaces ? value.slice(0, -1) : value;
3119
+ }
3120
+
3121
+ // ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/index.js
3122
+ var handle = {
3123
+ blockquote,
3124
+ break: hardBreak,
3125
+ code,
3126
+ definition,
3127
+ emphasis,
3128
+ hardBreak,
3129
+ heading,
3130
+ html,
3131
+ image,
3132
+ imageReference,
3133
+ inlineCode,
3134
+ link,
3135
+ linkReference,
3136
+ list,
3137
+ listItem,
3138
+ paragraph,
3139
+ root,
3140
+ strong,
3141
+ text,
3142
+ thematicBreak
3143
+ };
3144
+
3145
+ // ../../node_modules/.pnpm/mdast-util-gfm-table@2.0.0/node_modules/mdast-util-gfm-table/lib/index.js
3146
+ function gfmTableFromMarkdown() {
3147
+ return {
3148
+ enter: {
3149
+ table: enterTable,
3150
+ tableData: enterCell,
3151
+ tableHeader: enterCell,
3152
+ tableRow: enterRow
3153
+ },
3154
+ exit: {
3155
+ codeText: exitCodeText,
3156
+ table: exitTable,
3157
+ tableData: exit,
3158
+ tableHeader: exit,
3159
+ tableRow: exit
3160
+ }
3161
+ };
3162
+ }
3163
+ function enterTable(token) {
3164
+ const align = token._align;
3165
+ ok(align, "expected `_align` on table");
3166
+ this.enter(
3167
+ {
3168
+ type: "table",
3169
+ align: align.map(function(d) {
3170
+ return d === "none" ? null : d;
3171
+ }),
3172
+ children: []
3173
+ },
3174
+ token
3175
+ );
3176
+ this.data.inTable = true;
3177
+ }
3178
+ function exitTable(token) {
3179
+ this.exit(token);
3180
+ this.data.inTable = void 0;
3181
+ }
3182
+ function enterRow(token) {
3183
+ this.enter({ type: "tableRow", children: [] }, token);
3184
+ }
3185
+ function exit(token) {
3186
+ this.exit(token);
3187
+ }
3188
+ function enterCell(token) {
3189
+ this.enter({ type: "tableCell", children: [] }, token);
3190
+ }
3191
+ function exitCodeText(token) {
3192
+ let value = this.resume();
3193
+ if (this.data.inTable) {
3194
+ value = value.replace(/\\([\\|])/g, replace);
3195
+ }
3196
+ const node2 = this.stack[this.stack.length - 1];
3197
+ ok(node2.type === "inlineCode");
3198
+ node2.value = value;
3199
+ this.exit(token);
3200
+ }
3201
+ function replace($0, $1) {
3202
+ return $1 === "|" ? $1 : $0;
3203
+ }
3204
+ function gfmTableToMarkdown(options) {
3205
+ const settings = options || {};
3206
+ const padding = settings.tableCellPadding;
3207
+ const alignDelimiters = settings.tablePipeAlign;
3208
+ const stringLength = settings.stringLength;
3209
+ const around = padding ? " " : "|";
3210
+ return {
3211
+ unsafe: [
3212
+ { character: "\r", inConstruct: "tableCell" },
3213
+ { character: "\n", inConstruct: "tableCell" },
3214
+ // A pipe, when followed by a tab or space (padding), or a dash or colon
3215
+ // (unpadded delimiter row), could result in a table.
3216
+ { atBreak: true, character: "|", after: "[ :-]" },
3217
+ // A pipe in a cell must be encoded.
3218
+ { character: "|", inConstruct: "tableCell" },
3219
+ // A colon must be followed by a dash, in which case it could start a
3220
+ // delimiter row.
3221
+ { atBreak: true, character: ":", after: "-" },
3222
+ // A delimiter row can also start with a dash, when followed by more
3223
+ // dashes, a colon, or a pipe.
3224
+ // This is a stricter version than the built in check for lists, thematic
3225
+ // breaks, and setex heading underlines though:
3226
+ // <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>
3227
+ { atBreak: true, character: "-", after: "[:|-]" }
3228
+ ],
3229
+ handlers: {
3230
+ inlineCode: inlineCodeWithTable,
3231
+ table: handleTable,
3232
+ tableCell: handleTableCell,
3233
+ tableRow: handleTableRow
3234
+ }
3235
+ };
3236
+ function handleTable(node2, _, state, info) {
3237
+ return serializeData(handleTableAsData(node2, state, info), node2.align);
3238
+ }
3239
+ function handleTableRow(node2, _, state, info) {
3240
+ const row = handleTableRowAsData(node2, state, info);
3241
+ const value = serializeData([row]);
3242
+ return value.slice(0, value.indexOf("\n"));
3243
+ }
3244
+ function handleTableCell(node2, _, state, info) {
3245
+ const exit2 = state.enter("tableCell");
3246
+ const subexit = state.enter("phrasing");
3247
+ const value = state.containerPhrasing(node2, {
3248
+ ...info,
3249
+ before: around,
3250
+ after: around
3251
+ });
3252
+ subexit();
3253
+ exit2();
3254
+ return value;
3255
+ }
3256
+ function serializeData(matrix, align) {
3257
+ return markdownTable(matrix, {
3258
+ align,
3259
+ // @ts-expect-error: `markdown-table` types should support `null`.
3260
+ alignDelimiters,
3261
+ // @ts-expect-error: `markdown-table` types should support `null`.
3262
+ padding,
3263
+ // @ts-expect-error: `markdown-table` types should support `null`.
3264
+ stringLength
3265
+ });
3266
+ }
3267
+ function handleTableAsData(node2, state, info) {
3268
+ const children = node2.children;
3269
+ let index = -1;
3270
+ const result = [];
3271
+ const subexit = state.enter("table");
3272
+ while (++index < children.length) {
3273
+ result[index] = handleTableRowAsData(children[index], state, info);
3274
+ }
3275
+ subexit();
3276
+ return result;
3277
+ }
3278
+ function handleTableRowAsData(node2, state, info) {
3279
+ const children = node2.children;
3280
+ let index = -1;
3281
+ const result = [];
3282
+ const subexit = state.enter("tableRow");
3283
+ while (++index < children.length) {
3284
+ result[index] = handleTableCell(children[index], node2, state, info);
3285
+ }
3286
+ subexit();
3287
+ return result;
3288
+ }
3289
+ function inlineCodeWithTable(node2, parent, state) {
3290
+ let value = handle.inlineCode(node2, parent, state);
3291
+ if (state.stack.includes("tableCell")) {
3292
+ value = value.replace(/\|/g, "\\$&");
3293
+ }
3294
+ return value;
3295
+ }
3296
+ }
3297
+
3298
+ // ../../node_modules/.pnpm/mdast-util-gfm-task-list-item@2.0.0/node_modules/mdast-util-gfm-task-list-item/lib/index.js
3299
+ function gfmTaskListItemFromMarkdown() {
3300
+ return {
3301
+ exit: {
3302
+ taskListCheckValueChecked: exitCheck,
3303
+ taskListCheckValueUnchecked: exitCheck,
3304
+ paragraph: exitParagraphWithTaskListItem
3305
+ }
3306
+ };
3307
+ }
3308
+ function gfmTaskListItemToMarkdown() {
3309
+ return {
3310
+ unsafe: [{ atBreak: true, character: "-", after: "[:|-]" }],
3311
+ handlers: { listItem: listItemWithTaskListItem }
3312
+ };
3313
+ }
3314
+ function exitCheck(token) {
3315
+ const node2 = this.stack[this.stack.length - 2];
3316
+ ok(node2.type === "listItem");
3317
+ node2.checked = token.type === "taskListCheckValueChecked";
3318
+ }
3319
+ function exitParagraphWithTaskListItem(token) {
3320
+ const parent = this.stack[this.stack.length - 2];
3321
+ if (parent && parent.type === "listItem" && typeof parent.checked === "boolean") {
3322
+ const node2 = this.stack[this.stack.length - 1];
3323
+ ok(node2.type === "paragraph");
3324
+ const head = node2.children[0];
3325
+ if (head && head.type === "text") {
3326
+ const siblings = parent.children;
3327
+ let index = -1;
3328
+ let firstParaghraph;
3329
+ while (++index < siblings.length) {
3330
+ const sibling = siblings[index];
3331
+ if (sibling.type === "paragraph") {
3332
+ firstParaghraph = sibling;
3333
+ break;
3334
+ }
3335
+ }
3336
+ if (firstParaghraph === node2) {
3337
+ head.value = head.value.slice(1);
3338
+ if (head.value.length === 0) {
3339
+ node2.children.shift();
3340
+ } else if (node2.position && head.position && typeof head.position.start.offset === "number") {
3341
+ head.position.start.column++;
3342
+ head.position.start.offset++;
3343
+ node2.position.start = Object.assign({}, head.position.start);
3344
+ }
3345
+ }
3346
+ }
3347
+ }
3348
+ this.exit(token);
3349
+ }
3350
+ function listItemWithTaskListItem(node2, parent, state, info) {
3351
+ const head = node2.children[0];
3352
+ const checkable = typeof node2.checked === "boolean" && head && head.type === "paragraph";
3353
+ const checkbox = "[" + (node2.checked ? "x" : " ") + "] ";
3354
+ const tracker = state.createTracker(info);
3355
+ if (checkable) {
3356
+ tracker.move(checkbox);
3357
+ }
3358
+ let value = handle.listItem(node2, parent, state, {
3359
+ ...info,
3360
+ ...tracker.current()
3361
+ });
3362
+ if (checkable) {
3363
+ value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check);
3364
+ }
3365
+ return value;
3366
+ function check($0) {
3367
+ return $0 + checkbox;
3368
+ }
3369
+ }
3370
+
3371
+ // ../../node_modules/.pnpm/mdast-util-gfm@3.1.0/node_modules/mdast-util-gfm/lib/index.js
3372
+ function gfmFromMarkdown() {
3373
+ return [
3374
+ gfmAutolinkLiteralFromMarkdown(),
3375
+ gfmFootnoteFromMarkdown(),
3376
+ gfmStrikethroughFromMarkdown(),
3377
+ gfmTableFromMarkdown(),
3378
+ gfmTaskListItemFromMarkdown()
3379
+ ];
3380
+ }
3381
+ function gfmToMarkdown(options) {
3382
+ return {
3383
+ extensions: [
3384
+ gfmAutolinkLiteralToMarkdown(),
3385
+ gfmFootnoteToMarkdown(options),
3386
+ gfmStrikethroughToMarkdown(),
3387
+ gfmTableToMarkdown(options),
3388
+ gfmTaskListItemToMarkdown()
3389
+ ]
3390
+ };
3391
+ }
3392
+
3393
+ // ../../node_modules/.pnpm/micromark-util-chunked@2.0.1/node_modules/micromark-util-chunked/index.js
3394
+ function splice(list2, start, remove, items) {
3395
+ const end = list2.length;
3396
+ let chunkStart = 0;
3397
+ let parameters;
3398
+ if (start < 0) {
3399
+ start = -start > end ? 0 : end + start;
3400
+ } else {
3401
+ start = start > end ? end : start;
3402
+ }
3403
+ remove = remove > 0 ? remove : 0;
3404
+ if (items.length < 1e4) {
3405
+ parameters = Array.from(items);
3406
+ parameters.unshift(start, remove);
3407
+ list2.splice(...parameters);
3408
+ } else {
3409
+ if (remove) list2.splice(start, remove);
3410
+ while (chunkStart < items.length) {
3411
+ parameters = items.slice(chunkStart, chunkStart + 1e4);
3412
+ parameters.unshift(start, 0);
3413
+ list2.splice(...parameters);
3414
+ chunkStart += 1e4;
3415
+ start += 1e4;
3416
+ }
3417
+ }
3418
+ }
3419
+
3420
+ // ../../node_modules/.pnpm/micromark-util-combine-extensions@2.0.1/node_modules/micromark-util-combine-extensions/index.js
3421
+ var hasOwnProperty = {}.hasOwnProperty;
3422
+ function combineExtensions(extensions) {
3423
+ const all2 = {};
3424
+ let index = -1;
3425
+ while (++index < extensions.length) {
3426
+ syntaxExtension(all2, extensions[index]);
3427
+ }
3428
+ return all2;
3429
+ }
3430
+ function syntaxExtension(all2, extension) {
3431
+ let hook;
3432
+ for (hook in extension) {
3433
+ const maybe = hasOwnProperty.call(all2, hook) ? all2[hook] : void 0;
3434
+ const left = maybe || (all2[hook] = {});
3435
+ const right = extension[hook];
3436
+ let code3;
3437
+ if (right) {
3438
+ for (code3 in right) {
3439
+ if (!hasOwnProperty.call(left, code3)) left[code3] = [];
3440
+ const value = right[code3];
3441
+ constructs(
3442
+ // @ts-expect-error Looks like a list.
3443
+ left[code3],
3444
+ Array.isArray(value) ? value : value ? [value] : []
3445
+ );
3446
+ }
3447
+ }
3448
+ }
3449
+ }
3450
+ function constructs(existing, list2) {
3451
+ let index = -1;
3452
+ const before = [];
3453
+ while (++index < list2.length) {
3454
+ ;
3455
+ (list2[index].add === "after" ? existing : before).push(list2[index]);
3456
+ }
3457
+ splice(existing, 0, 0, before);
3458
+ }
3459
+
3460
+ // ../../node_modules/.pnpm/micromark-extension-gfm-autolink-literal@2.1.0/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
3461
+ var wwwPrefix = {
3462
+ tokenize: tokenizeWwwPrefix,
3463
+ partial: true
3464
+ };
3465
+ var domain = {
3466
+ tokenize: tokenizeDomain,
3467
+ partial: true
3468
+ };
3469
+ var path5 = {
3470
+ tokenize: tokenizePath,
3471
+ partial: true
3472
+ };
3473
+ var trail = {
3474
+ tokenize: tokenizeTrail,
3475
+ partial: true
3476
+ };
3477
+ var emailDomainDotTrail = {
3478
+ tokenize: tokenizeEmailDomainDotTrail,
3479
+ partial: true
3480
+ };
3481
+ var wwwAutolink = {
3482
+ name: "wwwAutolink",
3483
+ tokenize: tokenizeWwwAutolink,
3484
+ previous: previousWww
3485
+ };
3486
+ var protocolAutolink = {
3487
+ name: "protocolAutolink",
3488
+ tokenize: tokenizeProtocolAutolink,
3489
+ previous: previousProtocol
3490
+ };
3491
+ var emailAutolink = {
3492
+ name: "emailAutolink",
3493
+ tokenize: tokenizeEmailAutolink,
3494
+ previous: previousEmail
3495
+ };
3496
+ var text2 = {};
3497
+ function gfmAutolinkLiteral() {
3498
+ return {
3499
+ text: text2
3500
+ };
3501
+ }
3502
+ var code2 = 48;
3503
+ while (code2 < 123) {
3504
+ text2[code2] = emailAutolink;
3505
+ code2++;
3506
+ if (code2 === 58) code2 = 65;
3507
+ else if (code2 === 91) code2 = 97;
3508
+ }
3509
+ text2[43] = emailAutolink;
3510
+ text2[45] = emailAutolink;
3511
+ text2[46] = emailAutolink;
3512
+ text2[95] = emailAutolink;
3513
+ text2[72] = [emailAutolink, protocolAutolink];
3514
+ text2[104] = [emailAutolink, protocolAutolink];
3515
+ text2[87] = [emailAutolink, wwwAutolink];
3516
+ text2[119] = [emailAutolink, wwwAutolink];
3517
+ function tokenizeEmailAutolink(effects, ok3, nok) {
3518
+ const self = this;
3519
+ let dot;
3520
+ let data;
3521
+ return start;
3522
+ function start(code3) {
3523
+ if (!gfmAtext(code3) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {
3524
+ return nok(code3);
3525
+ }
3526
+ effects.enter("literalAutolink");
3527
+ effects.enter("literalAutolinkEmail");
3528
+ return atext(code3);
3529
+ }
3530
+ function atext(code3) {
3531
+ if (gfmAtext(code3)) {
3532
+ effects.consume(code3);
3533
+ return atext;
3534
+ }
3535
+ if (code3 === 64) {
3536
+ effects.consume(code3);
3537
+ return emailDomain;
3538
+ }
3539
+ return nok(code3);
3540
+ }
3541
+ function emailDomain(code3) {
3542
+ if (code3 === 46) {
3543
+ return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code3);
3544
+ }
3545
+ if (code3 === 45 || code3 === 95 || asciiAlphanumeric(code3)) {
3546
+ data = true;
3547
+ effects.consume(code3);
3548
+ return emailDomain;
3549
+ }
3550
+ return emailDomainAfter(code3);
3551
+ }
3552
+ function emailDomainDot(code3) {
3553
+ effects.consume(code3);
3554
+ dot = true;
3555
+ return emailDomain;
3556
+ }
3557
+ function emailDomainAfter(code3) {
3558
+ if (data && dot && asciiAlpha(self.previous)) {
3559
+ effects.exit("literalAutolinkEmail");
3560
+ effects.exit("literalAutolink");
3561
+ return ok3(code3);
3562
+ }
3563
+ return nok(code3);
3564
+ }
3565
+ }
3566
+ function tokenizeWwwAutolink(effects, ok3, nok) {
3567
+ const self = this;
3568
+ return wwwStart;
3569
+ function wwwStart(code3) {
3570
+ if (code3 !== 87 && code3 !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {
3571
+ return nok(code3);
3572
+ }
3573
+ effects.enter("literalAutolink");
3574
+ effects.enter("literalAutolinkWww");
3575
+ return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path5, wwwAfter), nok), nok)(code3);
3576
+ }
3577
+ function wwwAfter(code3) {
3578
+ effects.exit("literalAutolinkWww");
3579
+ effects.exit("literalAutolink");
3580
+ return ok3(code3);
3581
+ }
3582
+ }
3583
+ function tokenizeProtocolAutolink(effects, ok3, nok) {
3584
+ const self = this;
3585
+ let buffer = "";
3586
+ let seen = false;
3587
+ return protocolStart;
3588
+ function protocolStart(code3) {
3589
+ if ((code3 === 72 || code3 === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {
3590
+ effects.enter("literalAutolink");
3591
+ effects.enter("literalAutolinkHttp");
3592
+ buffer += String.fromCodePoint(code3);
3593
+ effects.consume(code3);
3594
+ return protocolPrefixInside;
3595
+ }
3596
+ return nok(code3);
3597
+ }
3598
+ function protocolPrefixInside(code3) {
3599
+ if (asciiAlpha(code3) && buffer.length < 5) {
3600
+ buffer += String.fromCodePoint(code3);
3601
+ effects.consume(code3);
3602
+ return protocolPrefixInside;
3603
+ }
3604
+ if (code3 === 58) {
3605
+ const protocol = buffer.toLowerCase();
3606
+ if (protocol === "http" || protocol === "https") {
3607
+ effects.consume(code3);
3608
+ return protocolSlashesInside;
3609
+ }
3610
+ }
3611
+ return nok(code3);
3612
+ }
3613
+ function protocolSlashesInside(code3) {
3614
+ if (code3 === 47) {
3615
+ effects.consume(code3);
3616
+ if (seen) {
3617
+ return afterProtocol;
3618
+ }
3619
+ seen = true;
3620
+ return protocolSlashesInside;
3621
+ }
3622
+ return nok(code3);
3623
+ }
3624
+ function afterProtocol(code3) {
3625
+ return code3 === null || asciiControl(code3) || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) || unicodePunctuation(code3) ? nok(code3) : effects.attempt(domain, effects.attempt(path5, protocolAfter), nok)(code3);
3626
+ }
3627
+ function protocolAfter(code3) {
3628
+ effects.exit("literalAutolinkHttp");
3629
+ effects.exit("literalAutolink");
3630
+ return ok3(code3);
3631
+ }
3632
+ }
3633
+ function tokenizeWwwPrefix(effects, ok3, nok) {
3634
+ let size = 0;
3635
+ return wwwPrefixInside;
3636
+ function wwwPrefixInside(code3) {
3637
+ if ((code3 === 87 || code3 === 119) && size < 3) {
3638
+ size++;
3639
+ effects.consume(code3);
3640
+ return wwwPrefixInside;
3641
+ }
3642
+ if (code3 === 46 && size === 3) {
3643
+ effects.consume(code3);
3644
+ return wwwPrefixAfter;
3645
+ }
3646
+ return nok(code3);
3647
+ }
3648
+ function wwwPrefixAfter(code3) {
3649
+ return code3 === null ? nok(code3) : ok3(code3);
3650
+ }
3651
+ }
3652
+ function tokenizeDomain(effects, ok3, nok) {
3653
+ let underscoreInLastSegment;
3654
+ let underscoreInLastLastSegment;
3655
+ let seen;
3656
+ return domainInside;
3657
+ function domainInside(code3) {
3658
+ if (code3 === 46 || code3 === 95) {
3659
+ return effects.check(trail, domainAfter, domainAtPunctuation)(code3);
3660
+ }
3661
+ if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) || code3 !== 45 && unicodePunctuation(code3)) {
3662
+ return domainAfter(code3);
3663
+ }
3664
+ seen = true;
3665
+ effects.consume(code3);
3666
+ return domainInside;
3667
+ }
3668
+ function domainAtPunctuation(code3) {
3669
+ if (code3 === 95) {
3670
+ underscoreInLastSegment = true;
3671
+ } else {
3672
+ underscoreInLastLastSegment = underscoreInLastSegment;
3673
+ underscoreInLastSegment = void 0;
3674
+ }
3675
+ effects.consume(code3);
3676
+ return domainInside;
3677
+ }
3678
+ function domainAfter(code3) {
3679
+ if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {
3680
+ return nok(code3);
3681
+ }
3682
+ return ok3(code3);
3683
+ }
3684
+ }
3685
+ function tokenizePath(effects, ok3) {
3686
+ let sizeOpen = 0;
3687
+ let sizeClose = 0;
3688
+ return pathInside;
3689
+ function pathInside(code3) {
3690
+ if (code3 === 40) {
3691
+ sizeOpen++;
3692
+ effects.consume(code3);
3693
+ return pathInside;
3694
+ }
3695
+ if (code3 === 41 && sizeClose < sizeOpen) {
3696
+ return pathAtPunctuation(code3);
3697
+ }
3698
+ if (code3 === 33 || code3 === 34 || code3 === 38 || code3 === 39 || code3 === 41 || code3 === 42 || code3 === 44 || code3 === 46 || code3 === 58 || code3 === 59 || code3 === 60 || code3 === 63 || code3 === 93 || code3 === 95 || code3 === 126) {
3699
+ return effects.check(trail, ok3, pathAtPunctuation)(code3);
3700
+ }
3701
+ if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
3702
+ return ok3(code3);
3703
+ }
3704
+ effects.consume(code3);
3705
+ return pathInside;
3706
+ }
3707
+ function pathAtPunctuation(code3) {
3708
+ if (code3 === 41) {
3709
+ sizeClose++;
3710
+ }
3711
+ effects.consume(code3);
3712
+ return pathInside;
3713
+ }
3714
+ }
3715
+ function tokenizeTrail(effects, ok3, nok) {
3716
+ return trail2;
3717
+ function trail2(code3) {
3718
+ if (code3 === 33 || code3 === 34 || code3 === 39 || code3 === 41 || code3 === 42 || code3 === 44 || code3 === 46 || code3 === 58 || code3 === 59 || code3 === 63 || code3 === 95 || code3 === 126) {
3719
+ effects.consume(code3);
3720
+ return trail2;
3721
+ }
3722
+ if (code3 === 38) {
3723
+ effects.consume(code3);
3724
+ return trailCharacterReferenceStart;
3725
+ }
3726
+ if (code3 === 93) {
3727
+ effects.consume(code3);
3728
+ return trailBracketAfter;
3729
+ }
3730
+ if (
3731
+ // `<` is an end.
3732
+ code3 === 60 || // So is whitespace.
3733
+ code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)
3734
+ ) {
3735
+ return ok3(code3);
3736
+ }
3737
+ return nok(code3);
3738
+ }
3739
+ function trailBracketAfter(code3) {
3740
+ if (code3 === null || code3 === 40 || code3 === 91 || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
3741
+ return ok3(code3);
3742
+ }
3743
+ return trail2(code3);
3744
+ }
3745
+ function trailCharacterReferenceStart(code3) {
3746
+ return asciiAlpha(code3) ? trailCharacterReferenceInside(code3) : nok(code3);
3747
+ }
3748
+ function trailCharacterReferenceInside(code3) {
3749
+ if (code3 === 59) {
3750
+ effects.consume(code3);
3751
+ return trail2;
3752
+ }
3753
+ if (asciiAlpha(code3)) {
3754
+ effects.consume(code3);
3755
+ return trailCharacterReferenceInside;
3756
+ }
3757
+ return nok(code3);
3758
+ }
3759
+ }
3760
+ function tokenizeEmailDomainDotTrail(effects, ok3, nok) {
3761
+ return start;
3762
+ function start(code3) {
3763
+ effects.consume(code3);
3764
+ return after;
3765
+ }
3766
+ function after(code3) {
3767
+ return asciiAlphanumeric(code3) ? nok(code3) : ok3(code3);
3768
+ }
3769
+ }
3770
+ function previousWww(code3) {
3771
+ return code3 === null || code3 === 40 || code3 === 42 || code3 === 95 || code3 === 91 || code3 === 93 || code3 === 126 || markdownLineEndingOrSpace(code3);
3772
+ }
3773
+ function previousProtocol(code3) {
3774
+ return !asciiAlpha(code3);
3775
+ }
3776
+ function previousEmail(code3) {
3777
+ return !(code3 === 47 || gfmAtext(code3));
3778
+ }
3779
+ function gfmAtext(code3) {
3780
+ return code3 === 43 || code3 === 45 || code3 === 46 || code3 === 95 || asciiAlphanumeric(code3);
3781
+ }
3782
+ function previousUnbalanced(events) {
3783
+ let index = events.length;
3784
+ let result = false;
3785
+ while (index--) {
3786
+ const token = events[index][1];
3787
+ if ((token.type === "labelLink" || token.type === "labelImage") && !token._balanced) {
3788
+ result = true;
3789
+ break;
3790
+ }
3791
+ if (token._gfmAutolinkLiteralWalkedInto) {
3792
+ result = false;
3793
+ break;
3794
+ }
3795
+ }
3796
+ if (events.length > 0 && !result) {
3797
+ events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;
3798
+ }
3799
+ return result;
3800
+ }
3801
+
3802
+ // ../../node_modules/.pnpm/micromark-util-resolve-all@2.0.1/node_modules/micromark-util-resolve-all/index.js
3803
+ function resolveAll(constructs2, events, context) {
3804
+ const called = [];
3805
+ let index = -1;
3806
+ while (++index < constructs2.length) {
3807
+ const resolve = constructs2[index].resolveAll;
3808
+ if (resolve && !called.includes(resolve)) {
3809
+ events = resolve(events, context);
3810
+ called.push(resolve);
3811
+ }
3812
+ }
3813
+ return events;
3814
+ }
3815
+
3816
+ // ../../node_modules/.pnpm/micromark-factory-space@2.0.1/node_modules/micromark-factory-space/index.js
3817
+ function factorySpace(effects, ok3, type, max) {
3818
+ const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
3819
+ let size = 0;
3820
+ return start;
3821
+ function start(code3) {
3822
+ if (markdownSpace(code3)) {
3823
+ effects.enter(type);
3824
+ return prefix(code3);
3825
+ }
3826
+ return ok3(code3);
3827
+ }
3828
+ function prefix(code3) {
3829
+ if (markdownSpace(code3) && size++ < limit) {
3830
+ effects.consume(code3);
3831
+ return prefix;
3832
+ }
3833
+ effects.exit(type);
3834
+ return ok3(code3);
3835
+ }
3836
+ }
3837
+
3838
+ // ../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/blank-line.js
3839
+ var blankLine = {
3840
+ partial: true,
3841
+ tokenize: tokenizeBlankLine
3842
+ };
3843
+ function tokenizeBlankLine(effects, ok3, nok) {
3844
+ return start;
3845
+ function start(code3) {
3846
+ return markdownSpace(code3) ? factorySpace(effects, after, "linePrefix")(code3) : after(code3);
3847
+ }
3848
+ function after(code3) {
3849
+ return code3 === null || markdownLineEnding(code3) ? ok3(code3) : nok(code3);
3850
+ }
3851
+ }
3852
+
3853
+ // ../../node_modules/.pnpm/micromark-extension-gfm-footnote@2.1.0/node_modules/micromark-extension-gfm-footnote/lib/syntax.js
3854
+ var indent = {
3855
+ tokenize: tokenizeIndent,
3856
+ partial: true
3857
+ };
3858
+ function gfmFootnote() {
3859
+ return {
3860
+ document: {
3861
+ [91]: {
3862
+ name: "gfmFootnoteDefinition",
3863
+ tokenize: tokenizeDefinitionStart,
3864
+ continuation: {
3865
+ tokenize: tokenizeDefinitionContinuation
3866
+ },
3867
+ exit: gfmFootnoteDefinitionEnd
3868
+ }
3869
+ },
3870
+ text: {
3871
+ [91]: {
3872
+ name: "gfmFootnoteCall",
3873
+ tokenize: tokenizeGfmFootnoteCall
3874
+ },
3875
+ [93]: {
3876
+ name: "gfmPotentialFootnoteCall",
3877
+ add: "after",
3878
+ tokenize: tokenizePotentialGfmFootnoteCall,
3879
+ resolveTo: resolveToPotentialGfmFootnoteCall
3880
+ }
3881
+ }
3882
+ };
3883
+ }
3884
+ function tokenizePotentialGfmFootnoteCall(effects, ok3, nok) {
3885
+ const self = this;
3886
+ let index = self.events.length;
3887
+ const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
3888
+ let labelStart;
3889
+ while (index--) {
3890
+ const token = self.events[index][1];
3891
+ if (token.type === "labelImage") {
3892
+ labelStart = token;
3893
+ break;
3894
+ }
3895
+ if (token.type === "gfmFootnoteCall" || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") {
3896
+ break;
3897
+ }
3898
+ }
3899
+ return start;
3900
+ function start(code3) {
3901
+ if (!labelStart || !labelStart._balanced) {
3902
+ return nok(code3);
3903
+ }
3904
+ const id = normalizeIdentifier(self.sliceSerialize({
3905
+ start: labelStart.end,
3906
+ end: self.now()
3907
+ }));
3908
+ if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
3909
+ return nok(code3);
3910
+ }
3911
+ effects.enter("gfmFootnoteCallLabelMarker");
3912
+ effects.consume(code3);
3913
+ effects.exit("gfmFootnoteCallLabelMarker");
3914
+ return ok3(code3);
3915
+ }
3916
+ }
3917
+ function resolveToPotentialGfmFootnoteCall(events, context) {
3918
+ let index = events.length;
3919
+ let labelStart;
3920
+ while (index--) {
3921
+ if (events[index][1].type === "labelImage" && events[index][0] === "enter") {
3922
+ labelStart = events[index][1];
3923
+ break;
3924
+ }
3925
+ }
3926
+ events[index + 1][1].type = "data";
3927
+ events[index + 3][1].type = "gfmFootnoteCallLabelMarker";
3928
+ const call = {
3929
+ type: "gfmFootnoteCall",
3930
+ start: Object.assign({}, events[index + 3][1].start),
3931
+ end: Object.assign({}, events[events.length - 1][1].end)
3932
+ };
3933
+ const marker = {
3934
+ type: "gfmFootnoteCallMarker",
3935
+ start: Object.assign({}, events[index + 3][1].end),
3936
+ end: Object.assign({}, events[index + 3][1].end)
3937
+ };
3938
+ marker.end.column++;
3939
+ marker.end.offset++;
3940
+ marker.end._bufferIndex++;
3941
+ const string = {
3942
+ type: "gfmFootnoteCallString",
3943
+ start: Object.assign({}, marker.end),
3944
+ end: Object.assign({}, events[events.length - 1][1].start)
3945
+ };
3946
+ const chunk = {
3947
+ type: "chunkString",
3948
+ contentType: "string",
3949
+ start: Object.assign({}, string.start),
3950
+ end: Object.assign({}, string.end)
3951
+ };
3952
+ const replacement = [
3953
+ // Take the `labelImageMarker` (now `data`, the `!`)
3954
+ events[index + 1],
3955
+ events[index + 2],
3956
+ ["enter", call, context],
3957
+ // The `[`
3958
+ events[index + 3],
3959
+ events[index + 4],
3960
+ // The `^`.
3961
+ ["enter", marker, context],
3962
+ ["exit", marker, context],
3963
+ // Everything in between.
3964
+ ["enter", string, context],
3965
+ ["enter", chunk, context],
3966
+ ["exit", chunk, context],
3967
+ ["exit", string, context],
3968
+ // The ending (`]`, properly parsed and labelled).
3969
+ events[events.length - 2],
3970
+ events[events.length - 1],
3971
+ ["exit", call, context]
3972
+ ];
3973
+ events.splice(index, events.length - index + 1, ...replacement);
3974
+ return events;
3975
+ }
3976
+ function tokenizeGfmFootnoteCall(effects, ok3, nok) {
3977
+ const self = this;
3978
+ const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
3979
+ let size = 0;
3980
+ let data;
3981
+ return start;
3982
+ function start(code3) {
3983
+ effects.enter("gfmFootnoteCall");
3984
+ effects.enter("gfmFootnoteCallLabelMarker");
3985
+ effects.consume(code3);
3986
+ effects.exit("gfmFootnoteCallLabelMarker");
3987
+ return callStart;
3988
+ }
3989
+ function callStart(code3) {
3990
+ if (code3 !== 94) return nok(code3);
3991
+ effects.enter("gfmFootnoteCallMarker");
3992
+ effects.consume(code3);
3993
+ effects.exit("gfmFootnoteCallMarker");
3994
+ effects.enter("gfmFootnoteCallString");
3995
+ effects.enter("chunkString").contentType = "string";
3996
+ return callData;
3997
+ }
3998
+ function callData(code3) {
3999
+ if (
4000
+ // Too long.
4001
+ size > 999 || // Closing brace with nothing.
4002
+ code3 === 93 && !data || // Space or tab is not supported by GFM for some reason.
4003
+ // `\n` and `[` not being supported makes sense.
4004
+ code3 === null || code3 === 91 || markdownLineEndingOrSpace(code3)
4005
+ ) {
4006
+ return nok(code3);
4007
+ }
4008
+ if (code3 === 93) {
4009
+ effects.exit("chunkString");
4010
+ const token = effects.exit("gfmFootnoteCallString");
4011
+ if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {
4012
+ return nok(code3);
4013
+ }
4014
+ effects.enter("gfmFootnoteCallLabelMarker");
4015
+ effects.consume(code3);
4016
+ effects.exit("gfmFootnoteCallLabelMarker");
4017
+ effects.exit("gfmFootnoteCall");
4018
+ return ok3;
4019
+ }
4020
+ if (!markdownLineEndingOrSpace(code3)) {
4021
+ data = true;
4022
+ }
4023
+ size++;
4024
+ effects.consume(code3);
4025
+ return code3 === 92 ? callEscape : callData;
4026
+ }
4027
+ function callEscape(code3) {
4028
+ if (code3 === 91 || code3 === 92 || code3 === 93) {
4029
+ effects.consume(code3);
4030
+ size++;
4031
+ return callData;
4032
+ }
4033
+ return callData(code3);
4034
+ }
4035
+ }
4036
+ function tokenizeDefinitionStart(effects, ok3, nok) {
4037
+ const self = this;
4038
+ const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
4039
+ let identifier;
4040
+ let size = 0;
4041
+ let data;
4042
+ return start;
4043
+ function start(code3) {
4044
+ effects.enter("gfmFootnoteDefinition")._container = true;
4045
+ effects.enter("gfmFootnoteDefinitionLabel");
4046
+ effects.enter("gfmFootnoteDefinitionLabelMarker");
4047
+ effects.consume(code3);
4048
+ effects.exit("gfmFootnoteDefinitionLabelMarker");
4049
+ return labelAtMarker;
4050
+ }
4051
+ function labelAtMarker(code3) {
4052
+ if (code3 === 94) {
4053
+ effects.enter("gfmFootnoteDefinitionMarker");
4054
+ effects.consume(code3);
4055
+ effects.exit("gfmFootnoteDefinitionMarker");
4056
+ effects.enter("gfmFootnoteDefinitionLabelString");
4057
+ effects.enter("chunkString").contentType = "string";
4058
+ return labelInside;
4059
+ }
4060
+ return nok(code3);
4061
+ }
4062
+ function labelInside(code3) {
4063
+ if (
4064
+ // Too long.
4065
+ size > 999 || // Closing brace with nothing.
4066
+ code3 === 93 && !data || // Space or tab is not supported by GFM for some reason.
4067
+ // `\n` and `[` not being supported makes sense.
4068
+ code3 === null || code3 === 91 || markdownLineEndingOrSpace(code3)
4069
+ ) {
4070
+ return nok(code3);
4071
+ }
4072
+ if (code3 === 93) {
4073
+ effects.exit("chunkString");
4074
+ const token = effects.exit("gfmFootnoteDefinitionLabelString");
4075
+ identifier = normalizeIdentifier(self.sliceSerialize(token));
4076
+ effects.enter("gfmFootnoteDefinitionLabelMarker");
4077
+ effects.consume(code3);
4078
+ effects.exit("gfmFootnoteDefinitionLabelMarker");
4079
+ effects.exit("gfmFootnoteDefinitionLabel");
4080
+ return labelAfter;
4081
+ }
4082
+ if (!markdownLineEndingOrSpace(code3)) {
4083
+ data = true;
4084
+ }
4085
+ size++;
4086
+ effects.consume(code3);
4087
+ return code3 === 92 ? labelEscape : labelInside;
4088
+ }
4089
+ function labelEscape(code3) {
4090
+ if (code3 === 91 || code3 === 92 || code3 === 93) {
4091
+ effects.consume(code3);
4092
+ size++;
4093
+ return labelInside;
4094
+ }
4095
+ return labelInside(code3);
4096
+ }
4097
+ function labelAfter(code3) {
4098
+ if (code3 === 58) {
4099
+ effects.enter("definitionMarker");
4100
+ effects.consume(code3);
4101
+ effects.exit("definitionMarker");
4102
+ if (!defined.includes(identifier)) {
4103
+ defined.push(identifier);
4104
+ }
4105
+ return factorySpace(effects, whitespaceAfter, "gfmFootnoteDefinitionWhitespace");
4106
+ }
4107
+ return nok(code3);
4108
+ }
4109
+ function whitespaceAfter(code3) {
4110
+ return ok3(code3);
4111
+ }
4112
+ }
4113
+ function tokenizeDefinitionContinuation(effects, ok3, nok) {
4114
+ return effects.check(blankLine, ok3, effects.attempt(indent, ok3, nok));
4115
+ }
4116
+ function gfmFootnoteDefinitionEnd(effects) {
4117
+ effects.exit("gfmFootnoteDefinition");
4118
+ }
4119
+ function tokenizeIndent(effects, ok3, nok) {
4120
+ const self = this;
4121
+ return factorySpace(effects, afterPrefix, "gfmFootnoteDefinitionIndent", 4 + 1);
4122
+ function afterPrefix(code3) {
4123
+ const tail = self.events[self.events.length - 1];
4124
+ return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok3(code3) : nok(code3);
4125
+ }
4126
+ }
4127
+
4128
+ // ../../node_modules/.pnpm/micromark-extension-gfm-strikethrough@2.1.0/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
4129
+ function gfmStrikethrough(options) {
4130
+ const options_ = options || {};
4131
+ let single = options_.singleTilde;
4132
+ const tokenizer = {
4133
+ name: "strikethrough",
4134
+ tokenize: tokenizeStrikethrough,
4135
+ resolveAll: resolveAllStrikethrough
4136
+ };
4137
+ if (single === null || single === void 0) {
4138
+ single = true;
4139
+ }
4140
+ return {
4141
+ text: {
4142
+ [126]: tokenizer
4143
+ },
4144
+ insideSpan: {
4145
+ null: [tokenizer]
4146
+ },
4147
+ attentionMarkers: {
4148
+ null: [126]
4149
+ }
4150
+ };
4151
+ function resolveAllStrikethrough(events, context) {
4152
+ let index = -1;
4153
+ while (++index < events.length) {
4154
+ if (events[index][0] === "enter" && events[index][1].type === "strikethroughSequenceTemporary" && events[index][1]._close) {
4155
+ let open = index;
4156
+ while (open--) {
4157
+ if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && // If the sizes are the same:
4158
+ events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {
4159
+ events[index][1].type = "strikethroughSequence";
4160
+ events[open][1].type = "strikethroughSequence";
4161
+ const strikethrough = {
4162
+ type: "strikethrough",
4163
+ start: Object.assign({}, events[open][1].start),
4164
+ end: Object.assign({}, events[index][1].end)
4165
+ };
4166
+ const text3 = {
4167
+ type: "strikethroughText",
4168
+ start: Object.assign({}, events[open][1].end),
4169
+ end: Object.assign({}, events[index][1].start)
4170
+ };
4171
+ const nextEvents = [["enter", strikethrough, context], ["enter", events[open][1], context], ["exit", events[open][1], context], ["enter", text3, context]];
4172
+ const insideSpan = context.parser.constructs.insideSpan.null;
4173
+ if (insideSpan) {
4174
+ splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));
4175
+ }
4176
+ splice(nextEvents, nextEvents.length, 0, [["exit", text3, context], ["enter", events[index][1], context], ["exit", events[index][1], context], ["exit", strikethrough, context]]);
4177
+ splice(events, open - 1, index - open + 3, nextEvents);
4178
+ index = open + nextEvents.length - 2;
4179
+ break;
4180
+ }
4181
+ }
4182
+ }
4183
+ }
4184
+ index = -1;
4185
+ while (++index < events.length) {
4186
+ if (events[index][1].type === "strikethroughSequenceTemporary") {
4187
+ events[index][1].type = "data";
4188
+ }
4189
+ }
4190
+ return events;
4191
+ }
4192
+ function tokenizeStrikethrough(effects, ok3, nok) {
4193
+ const previous2 = this.previous;
4194
+ const events = this.events;
4195
+ let size = 0;
4196
+ return start;
4197
+ function start(code3) {
4198
+ if (previous2 === 126 && events[events.length - 1][1].type !== "characterEscape") {
4199
+ return nok(code3);
4200
+ }
4201
+ effects.enter("strikethroughSequenceTemporary");
4202
+ return more(code3);
4203
+ }
4204
+ function more(code3) {
4205
+ const before = classifyCharacter(previous2);
4206
+ if (code3 === 126) {
4207
+ if (size > 1) return nok(code3);
4208
+ effects.consume(code3);
4209
+ size++;
4210
+ return more;
4211
+ }
4212
+ if (size < 2 && !single) return nok(code3);
4213
+ const token = effects.exit("strikethroughSequenceTemporary");
4214
+ const after = classifyCharacter(code3);
4215
+ token._open = !after || after === 2 && Boolean(before);
4216
+ token._close = !before || before === 2 && Boolean(after);
4217
+ return ok3(code3);
4218
+ }
4219
+ }
4220
+ }
4221
+
4222
+ // ../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.1/node_modules/micromark-extension-gfm-table/lib/edit-map.js
4223
+ var EditMap = class {
4224
+ /**
4225
+ * Create a new edit map.
4226
+ */
4227
+ constructor() {
4228
+ this.map = [];
4229
+ }
4230
+ /**
4231
+ * Create an edit: a remove and/or add at a certain place.
4232
+ *
4233
+ * @param {number} index
4234
+ * @param {number} remove
4235
+ * @param {Array<Event>} add
4236
+ * @returns {undefined}
4237
+ */
4238
+ add(index, remove, add) {
4239
+ addImplementation(this, index, remove, add);
4240
+ }
4241
+ // To do: add this when moving to `micromark`.
4242
+ // /**
4243
+ // * Create an edit: but insert `add` before existing additions.
4244
+ // *
4245
+ // * @param {number} index
4246
+ // * @param {number} remove
4247
+ // * @param {Array<Event>} add
4248
+ // * @returns {undefined}
4249
+ // */
4250
+ // addBefore(index, remove, add) {
4251
+ // addImplementation(this, index, remove, add, true)
4252
+ // }
4253
+ /**
4254
+ * Done, change the events.
4255
+ *
4256
+ * @param {Array<Event>} events
4257
+ * @returns {undefined}
4258
+ */
4259
+ consume(events) {
4260
+ this.map.sort(function(a, b) {
4261
+ return a[0] - b[0];
4262
+ });
4263
+ if (this.map.length === 0) {
4264
+ return;
4265
+ }
4266
+ let index = this.map.length;
4267
+ const vecs = [];
4268
+ while (index > 0) {
4269
+ index -= 1;
4270
+ vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
4271
+ events.length = this.map[index][0];
4272
+ }
4273
+ vecs.push(events.slice());
4274
+ events.length = 0;
4275
+ let slice = vecs.pop();
4276
+ while (slice) {
4277
+ for (const element of slice) {
4278
+ events.push(element);
4279
+ }
4280
+ slice = vecs.pop();
4281
+ }
4282
+ this.map.length = 0;
4283
+ }
4284
+ };
4285
+ function addImplementation(editMap, at, remove, add) {
4286
+ let index = 0;
4287
+ if (remove === 0 && add.length === 0) {
4288
+ return;
4289
+ }
4290
+ while (index < editMap.map.length) {
4291
+ if (editMap.map[index][0] === at) {
4292
+ editMap.map[index][1] += remove;
4293
+ editMap.map[index][2].push(...add);
4294
+ return;
4295
+ }
4296
+ index += 1;
4297
+ }
4298
+ editMap.map.push([at, remove, add]);
4299
+ }
4300
+
4301
+ // ../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.1/node_modules/micromark-extension-gfm-table/lib/infer.js
4302
+ function gfmTableAlign(events, index) {
4303
+ let inDelimiterRow = false;
4304
+ const align = [];
4305
+ while (index < events.length) {
4306
+ const event = events[index];
4307
+ if (inDelimiterRow) {
4308
+ if (event[0] === "enter") {
4309
+ if (event[1].type === "tableContent") {
4310
+ align.push(events[index + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
4311
+ }
4312
+ } else if (event[1].type === "tableContent") {
4313
+ if (events[index - 1][1].type === "tableDelimiterMarker") {
4314
+ const alignIndex = align.length - 1;
4315
+ align[alignIndex] = align[alignIndex] === "left" ? "center" : "right";
4316
+ }
4317
+ } else if (event[1].type === "tableDelimiterRow") {
4318
+ break;
4319
+ }
4320
+ } else if (event[0] === "enter" && event[1].type === "tableDelimiterRow") {
4321
+ inDelimiterRow = true;
4322
+ }
4323
+ index += 1;
4324
+ }
4325
+ return align;
1171
4326
  }
1172
- function merge(generated, manual, options = {}) {
1173
- const orphans = [];
1174
- const warnings = [];
1175
- const now = options.now ?? (/* @__PURE__ */ new Date()).toISOString();
1176
- const sourceFile = options.sourceFile ?? manual.filePath;
1177
- const anchorToBlocks = /* @__PURE__ */ new Map();
1178
- const anchorless = [];
1179
- for (const block of manual.protectedBlocks) {
1180
- if (!block.anchorId) {
1181
- anchorless.push(block);
1182
- continue;
4327
+
4328
+ // ../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.1/node_modules/micromark-extension-gfm-table/lib/syntax.js
4329
+ function gfmTable() {
4330
+ return {
4331
+ flow: {
4332
+ null: {
4333
+ name: "table",
4334
+ tokenize: tokenizeTable,
4335
+ resolveAll: resolveTable
4336
+ }
4337
+ }
4338
+ };
4339
+ }
4340
+ function tokenizeTable(effects, ok3, nok) {
4341
+ const self = this;
4342
+ let size = 0;
4343
+ let sizeB = 0;
4344
+ let seen;
4345
+ return start;
4346
+ function start(code3) {
4347
+ let index = self.events.length - 1;
4348
+ while (index > -1) {
4349
+ const type = self.events[index][1].type;
4350
+ if (type === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
4351
+ type === "linePrefix") index--;
4352
+ else break;
1183
4353
  }
1184
- let list = anchorToBlocks.get(block.anchorId);
1185
- if (!list) {
1186
- list = [];
1187
- anchorToBlocks.set(block.anchorId, list);
4354
+ const tail = index > -1 ? self.events[index][1].type : null;
4355
+ const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
4356
+ if (next === bodyRowStart && self.parser.lazy[self.now().line]) {
4357
+ return nok(code3);
1188
4358
  }
1189
- list.push(block);
4359
+ return next(code3);
1190
4360
  }
1191
- for (const block of anchorless) {
1192
- warnings.push(`Protected block ${block.id} has no associated anchor \u2014 treated as orphan.`);
1193
- orphans.push(orphanFromBlock(block, void 0, sourceFile, now));
4361
+ function headRowBefore(code3) {
4362
+ effects.enter("tableHead");
4363
+ effects.enter("tableRow");
4364
+ return headRowStart(code3);
1194
4365
  }
1195
- const anchors = findAnchors(generated);
1196
- if (anchors.length === 0) {
1197
- for (const [anchorId2, blocks] of anchorToBlocks) {
1198
- for (const block of blocks) {
1199
- orphans.push(orphanFromBlock(block, anchorId2, sourceFile, now));
4366
+ function headRowStart(code3) {
4367
+ if (code3 === 124) {
4368
+ return headRowBreak(code3);
4369
+ }
4370
+ seen = true;
4371
+ sizeB += 1;
4372
+ return headRowBreak(code3);
4373
+ }
4374
+ function headRowBreak(code3) {
4375
+ if (code3 === null) {
4376
+ return nok(code3);
4377
+ }
4378
+ if (markdownLineEnding(code3)) {
4379
+ if (sizeB > 1) {
4380
+ sizeB = 0;
4381
+ self.interrupt = true;
4382
+ effects.exit("tableRow");
4383
+ effects.enter("lineEnding");
4384
+ effects.consume(code3);
4385
+ effects.exit("lineEnding");
4386
+ return headDelimiterStart;
1200
4387
  }
4388
+ return nok(code3);
1201
4389
  }
1202
- return { content: generated, orphans, warnings };
4390
+ if (markdownSpace(code3)) {
4391
+ return factorySpace(effects, headRowBreak, "whitespace")(code3);
4392
+ }
4393
+ sizeB += 1;
4394
+ if (seen) {
4395
+ seen = false;
4396
+ size += 1;
4397
+ }
4398
+ if (code3 === 124) {
4399
+ effects.enter("tableCellDivider");
4400
+ effects.consume(code3);
4401
+ effects.exit("tableCellDivider");
4402
+ seen = true;
4403
+ return headRowBreak;
4404
+ }
4405
+ effects.enter("data");
4406
+ return headRowData(code3);
1203
4407
  }
1204
- const pieces = [];
1205
- let cursor = 0;
1206
- for (let i = 0; i < anchors.length; i++) {
1207
- const anchor = anchors[i];
1208
- const sectionEnd = findSectionEnd(generated, anchor.endIndex);
1209
- pieces.push(generated.slice(cursor, sectionEnd));
1210
- const blocks = anchorToBlocks.get(anchor.id);
1211
- if (blocks && blocks.length > 0) {
1212
- pieces.push(renderBlocks(blocks));
1213
- anchorToBlocks.delete(anchor.id);
4408
+ function headRowData(code3) {
4409
+ if (code3 === null || code3 === 124 || markdownLineEndingOrSpace(code3)) {
4410
+ effects.exit("data");
4411
+ return headRowBreak(code3);
1214
4412
  }
1215
- cursor = sectionEnd;
4413
+ effects.consume(code3);
4414
+ return code3 === 92 ? headRowEscape : headRowData;
1216
4415
  }
1217
- if (cursor < generated.length) {
1218
- pieces.push(generated.slice(cursor));
4416
+ function headRowEscape(code3) {
4417
+ if (code3 === 92 || code3 === 124) {
4418
+ effects.consume(code3);
4419
+ return headRowData;
4420
+ }
4421
+ return headRowData(code3);
1219
4422
  }
1220
- for (const [anchorId2, blocks] of anchorToBlocks) {
1221
- for (const block of blocks) {
1222
- orphans.push(orphanFromBlock(block, anchorId2, sourceFile, now));
4423
+ function headDelimiterStart(code3) {
4424
+ self.interrupt = false;
4425
+ if (self.parser.lazy[self.now().line]) {
4426
+ return nok(code3);
4427
+ }
4428
+ effects.enter("tableDelimiterRow");
4429
+ seen = false;
4430
+ if (markdownSpace(code3)) {
4431
+ return factorySpace(effects, headDelimiterBefore, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code3);
1223
4432
  }
4433
+ return headDelimiterBefore(code3);
4434
+ }
4435
+ function headDelimiterBefore(code3) {
4436
+ if (code3 === 45 || code3 === 58) {
4437
+ return headDelimiterValueBefore(code3);
4438
+ }
4439
+ if (code3 === 124) {
4440
+ seen = true;
4441
+ effects.enter("tableCellDivider");
4442
+ effects.consume(code3);
4443
+ effects.exit("tableCellDivider");
4444
+ return headDelimiterCellBefore;
4445
+ }
4446
+ return headDelimiterNok(code3);
4447
+ }
4448
+ function headDelimiterCellBefore(code3) {
4449
+ if (markdownSpace(code3)) {
4450
+ return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code3);
4451
+ }
4452
+ return headDelimiterValueBefore(code3);
4453
+ }
4454
+ function headDelimiterValueBefore(code3) {
4455
+ if (code3 === 58) {
4456
+ sizeB += 1;
4457
+ seen = true;
4458
+ effects.enter("tableDelimiterMarker");
4459
+ effects.consume(code3);
4460
+ effects.exit("tableDelimiterMarker");
4461
+ return headDelimiterLeftAlignmentAfter;
4462
+ }
4463
+ if (code3 === 45) {
4464
+ sizeB += 1;
4465
+ return headDelimiterLeftAlignmentAfter(code3);
4466
+ }
4467
+ if (code3 === null || markdownLineEnding(code3)) {
4468
+ return headDelimiterCellAfter(code3);
4469
+ }
4470
+ return headDelimiterNok(code3);
4471
+ }
4472
+ function headDelimiterLeftAlignmentAfter(code3) {
4473
+ if (code3 === 45) {
4474
+ effects.enter("tableDelimiterFiller");
4475
+ return headDelimiterFiller(code3);
4476
+ }
4477
+ return headDelimiterNok(code3);
4478
+ }
4479
+ function headDelimiterFiller(code3) {
4480
+ if (code3 === 45) {
4481
+ effects.consume(code3);
4482
+ return headDelimiterFiller;
4483
+ }
4484
+ if (code3 === 58) {
4485
+ seen = true;
4486
+ effects.exit("tableDelimiterFiller");
4487
+ effects.enter("tableDelimiterMarker");
4488
+ effects.consume(code3);
4489
+ effects.exit("tableDelimiterMarker");
4490
+ return headDelimiterRightAlignmentAfter;
4491
+ }
4492
+ effects.exit("tableDelimiterFiller");
4493
+ return headDelimiterRightAlignmentAfter(code3);
4494
+ }
4495
+ function headDelimiterRightAlignmentAfter(code3) {
4496
+ if (markdownSpace(code3)) {
4497
+ return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code3);
4498
+ }
4499
+ return headDelimiterCellAfter(code3);
4500
+ }
4501
+ function headDelimiterCellAfter(code3) {
4502
+ if (code3 === 124) {
4503
+ return headDelimiterBefore(code3);
4504
+ }
4505
+ if (code3 === null || markdownLineEnding(code3)) {
4506
+ if (!seen || size !== sizeB) {
4507
+ return headDelimiterNok(code3);
4508
+ }
4509
+ effects.exit("tableDelimiterRow");
4510
+ effects.exit("tableHead");
4511
+ return ok3(code3);
4512
+ }
4513
+ return headDelimiterNok(code3);
4514
+ }
4515
+ function headDelimiterNok(code3) {
4516
+ return nok(code3);
4517
+ }
4518
+ function bodyRowStart(code3) {
4519
+ effects.enter("tableRow");
4520
+ return bodyRowBreak(code3);
4521
+ }
4522
+ function bodyRowBreak(code3) {
4523
+ if (code3 === 124) {
4524
+ effects.enter("tableCellDivider");
4525
+ effects.consume(code3);
4526
+ effects.exit("tableCellDivider");
4527
+ return bodyRowBreak;
4528
+ }
4529
+ if (code3 === null || markdownLineEnding(code3)) {
4530
+ effects.exit("tableRow");
4531
+ return ok3(code3);
4532
+ }
4533
+ if (markdownSpace(code3)) {
4534
+ return factorySpace(effects, bodyRowBreak, "whitespace")(code3);
4535
+ }
4536
+ effects.enter("data");
4537
+ return bodyRowData(code3);
4538
+ }
4539
+ function bodyRowData(code3) {
4540
+ if (code3 === null || code3 === 124 || markdownLineEndingOrSpace(code3)) {
4541
+ effects.exit("data");
4542
+ return bodyRowBreak(code3);
4543
+ }
4544
+ effects.consume(code3);
4545
+ return code3 === 92 ? bodyRowEscape : bodyRowData;
4546
+ }
4547
+ function bodyRowEscape(code3) {
4548
+ if (code3 === 92 || code3 === 124) {
4549
+ effects.consume(code3);
4550
+ return bodyRowData;
4551
+ }
4552
+ return bodyRowData(code3);
1224
4553
  }
1225
- return { content: pieces.join(""), orphans, warnings };
1226
4554
  }
1227
- function findSectionEnd(content, from) {
1228
- const re = /\n(#{1,6} )/g;
1229
- re.lastIndex = from;
1230
- const m = re.exec(content);
1231
- return m ? m.index + 1 : content.length;
4555
+ function resolveTable(events, context) {
4556
+ let index = -1;
4557
+ let inFirstCellAwaitingPipe = true;
4558
+ let rowKind = 0;
4559
+ let lastCell = [0, 0, 0, 0];
4560
+ let cell = [0, 0, 0, 0];
4561
+ let afterHeadAwaitingFirstBodyRow = false;
4562
+ let lastTableEnd = 0;
4563
+ let currentTable;
4564
+ let currentBody;
4565
+ let currentCell;
4566
+ const map3 = new EditMap();
4567
+ while (++index < events.length) {
4568
+ const event = events[index];
4569
+ const token = event[1];
4570
+ if (event[0] === "enter") {
4571
+ if (token.type === "tableHead") {
4572
+ afterHeadAwaitingFirstBodyRow = false;
4573
+ if (lastTableEnd !== 0) {
4574
+ flushTableEnd(map3, context, lastTableEnd, currentTable, currentBody);
4575
+ currentBody = void 0;
4576
+ lastTableEnd = 0;
4577
+ }
4578
+ currentTable = {
4579
+ type: "table",
4580
+ start: Object.assign({}, token.start),
4581
+ // Note: correct end is set later.
4582
+ end: Object.assign({}, token.end)
4583
+ };
4584
+ map3.add(index, 0, [["enter", currentTable, context]]);
4585
+ } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
4586
+ inFirstCellAwaitingPipe = true;
4587
+ currentCell = void 0;
4588
+ lastCell = [0, 0, 0, 0];
4589
+ cell = [0, index + 1, 0, 0];
4590
+ if (afterHeadAwaitingFirstBodyRow) {
4591
+ afterHeadAwaitingFirstBodyRow = false;
4592
+ currentBody = {
4593
+ type: "tableBody",
4594
+ start: Object.assign({}, token.start),
4595
+ // Note: correct end is set later.
4596
+ end: Object.assign({}, token.end)
4597
+ };
4598
+ map3.add(index, 0, [["enter", currentBody, context]]);
4599
+ }
4600
+ rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1;
4601
+ } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
4602
+ inFirstCellAwaitingPipe = false;
4603
+ if (cell[2] === 0) {
4604
+ if (lastCell[1] !== 0) {
4605
+ cell[0] = cell[1];
4606
+ currentCell = flushCell(map3, context, lastCell, rowKind, void 0, currentCell);
4607
+ lastCell = [0, 0, 0, 0];
4608
+ }
4609
+ cell[2] = index;
4610
+ }
4611
+ } else if (token.type === "tableCellDivider") {
4612
+ if (inFirstCellAwaitingPipe) {
4613
+ inFirstCellAwaitingPipe = false;
4614
+ } else {
4615
+ if (lastCell[1] !== 0) {
4616
+ cell[0] = cell[1];
4617
+ currentCell = flushCell(map3, context, lastCell, rowKind, void 0, currentCell);
4618
+ }
4619
+ lastCell = cell;
4620
+ cell = [lastCell[1], index, 0, 0];
4621
+ }
4622
+ }
4623
+ } else if (token.type === "tableHead") {
4624
+ afterHeadAwaitingFirstBodyRow = true;
4625
+ lastTableEnd = index;
4626
+ } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
4627
+ lastTableEnd = index;
4628
+ if (lastCell[1] !== 0) {
4629
+ cell[0] = cell[1];
4630
+ currentCell = flushCell(map3, context, lastCell, rowKind, index, currentCell);
4631
+ } else if (cell[1] !== 0) {
4632
+ currentCell = flushCell(map3, context, cell, rowKind, index, currentCell);
4633
+ }
4634
+ rowKind = 0;
4635
+ } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
4636
+ cell[3] = index;
4637
+ }
4638
+ }
4639
+ if (lastTableEnd !== 0) {
4640
+ flushTableEnd(map3, context, lastTableEnd, currentTable, currentBody);
4641
+ }
4642
+ map3.consume(context.events);
4643
+ index = -1;
4644
+ while (++index < context.events.length) {
4645
+ const event = context.events[index];
4646
+ if (event[0] === "enter" && event[1].type === "table") {
4647
+ event[1]._align = gfmTableAlign(context.events, index);
4648
+ }
4649
+ }
4650
+ return events;
4651
+ }
4652
+ function flushCell(map3, context, range, rowKind, rowEnd, previousCell) {
4653
+ const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData";
4654
+ const valueName = "tableContent";
4655
+ if (range[0] !== 0) {
4656
+ previousCell.end = Object.assign({}, getPoint(context.events, range[0]));
4657
+ map3.add(range[0], 0, [["exit", previousCell, context]]);
4658
+ }
4659
+ const now = getPoint(context.events, range[1]);
4660
+ previousCell = {
4661
+ type: groupName,
4662
+ start: Object.assign({}, now),
4663
+ // Note: correct end is set later.
4664
+ end: Object.assign({}, now)
4665
+ };
4666
+ map3.add(range[1], 0, [["enter", previousCell, context]]);
4667
+ if (range[2] !== 0) {
4668
+ const relatedStart = getPoint(context.events, range[2]);
4669
+ const relatedEnd = getPoint(context.events, range[3]);
4670
+ const valueToken = {
4671
+ type: valueName,
4672
+ start: Object.assign({}, relatedStart),
4673
+ end: Object.assign({}, relatedEnd)
4674
+ };
4675
+ map3.add(range[2], 0, [["enter", valueToken, context]]);
4676
+ if (rowKind !== 2) {
4677
+ const start = context.events[range[2]];
4678
+ const end = context.events[range[3]];
4679
+ start[1].end = Object.assign({}, end[1].end);
4680
+ start[1].type = "chunkText";
4681
+ start[1].contentType = "text";
4682
+ if (range[3] > range[2] + 1) {
4683
+ const a = range[2] + 1;
4684
+ const b = range[3] - range[2] - 1;
4685
+ map3.add(a, b, []);
4686
+ }
4687
+ }
4688
+ map3.add(range[3] + 1, 0, [["exit", valueToken, context]]);
4689
+ }
4690
+ if (rowEnd !== void 0) {
4691
+ previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));
4692
+ map3.add(rowEnd, 0, [["exit", previousCell, context]]);
4693
+ previousCell = void 0;
4694
+ }
4695
+ return previousCell;
4696
+ }
4697
+ function flushTableEnd(map3, context, index, table, tableBody) {
4698
+ const exits = [];
4699
+ const related = getPoint(context.events, index);
4700
+ if (tableBody) {
4701
+ tableBody.end = Object.assign({}, related);
4702
+ exits.push(["exit", tableBody, context]);
4703
+ }
4704
+ table.end = Object.assign({}, related);
4705
+ exits.push(["exit", table, context]);
4706
+ map3.add(index + 1, 0, exits);
1232
4707
  }
1233
- function renderBlocks(blocks) {
1234
- return blocks.map((b) => renderBlock(b)).join("\n");
4708
+ function getPoint(events, index) {
4709
+ const event = events[index];
4710
+ const side = event[0] === "enter" ? "start" : "end";
4711
+ return event[1][side];
1235
4712
  }
1236
- function renderBlock(block) {
1237
- const idAttr = block.hasExplicitId ? ` id="${block.id}"` : "";
1238
- return `<!-- @manual:start${idAttr} -->
1239
- ${block.content}
1240
- <!-- @manual:end -->
1241
4713
 
1242
- `;
1243
- }
1244
- function orphanFromBlock(block, anchorId2, sourceFile, orphanedAt) {
1245
- const out = {
1246
- orphanedAt,
1247
- sourceFile,
1248
- anchorId: anchorId2 ?? "unknown",
1249
- content: block.content
4714
+ // ../../node_modules/.pnpm/micromark-extension-gfm-task-list-item@2.1.0/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
4715
+ var tasklistCheck = {
4716
+ name: "tasklistCheck",
4717
+ tokenize: tokenizeTasklistCheck
4718
+ };
4719
+ function gfmTaskListItem() {
4720
+ return {
4721
+ text: {
4722
+ [91]: tasklistCheck
4723
+ }
1250
4724
  };
1251
- if (block.hasExplicitId) out.manualBlockId = block.id;
1252
- return out;
1253
4725
  }
1254
- function slugifyAnchor(anchorId2) {
1255
- return anchorId2.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
4726
+ function tokenizeTasklistCheck(effects, ok3, nok) {
4727
+ const self = this;
4728
+ return open;
4729
+ function open(code3) {
4730
+ if (
4731
+ // Exit if there’s stuff before.
4732
+ self.previous !== null || // Exit if not in the first content that is the first child of a list
4733
+ // item.
4734
+ !self._gfmTasklistFirstContentOfListItem
4735
+ ) {
4736
+ return nok(code3);
4737
+ }
4738
+ effects.enter("taskListCheck");
4739
+ effects.enter("taskListCheckMarker");
4740
+ effects.consume(code3);
4741
+ effects.exit("taskListCheckMarker");
4742
+ return inside;
4743
+ }
4744
+ function inside(code3) {
4745
+ if (markdownLineEndingOrSpace(code3)) {
4746
+ effects.enter("taskListCheckValueUnchecked");
4747
+ effects.consume(code3);
4748
+ effects.exit("taskListCheckValueUnchecked");
4749
+ return close2;
4750
+ }
4751
+ if (code3 === 88 || code3 === 120) {
4752
+ effects.enter("taskListCheckValueChecked");
4753
+ effects.consume(code3);
4754
+ effects.exit("taskListCheckValueChecked");
4755
+ return close2;
4756
+ }
4757
+ return nok(code3);
4758
+ }
4759
+ function close2(code3) {
4760
+ if (code3 === 93) {
4761
+ effects.enter("taskListCheckMarker");
4762
+ effects.consume(code3);
4763
+ effects.exit("taskListCheckMarker");
4764
+ effects.exit("taskListCheck");
4765
+ return after;
4766
+ }
4767
+ return nok(code3);
4768
+ }
4769
+ function after(code3) {
4770
+ if (markdownLineEnding(code3)) {
4771
+ return ok3(code3);
4772
+ }
4773
+ if (markdownSpace(code3)) {
4774
+ return effects.check({
4775
+ tokenize: spaceThenNonSpace
4776
+ }, ok3, nok)(code3);
4777
+ }
4778
+ return nok(code3);
4779
+ }
1256
4780
  }
1257
- function formatDateUTC(d) {
1258
- const y = d.getUTCFullYear();
1259
- const m = String(d.getUTCMonth() + 1).padStart(2, "0");
1260
- const day = String(d.getUTCDate()).padStart(2, "0");
1261
- return `${y}-${m}-${day}`;
4781
+ function spaceThenNonSpace(effects, ok3, nok) {
4782
+ return factorySpace(effects, after, "whitespace");
4783
+ function after(code3) {
4784
+ return code3 === null ? nok(code3) : ok3(code3);
4785
+ }
1262
4786
  }
1263
- function renderOrphanFile(record) {
1264
- const fields = {
1265
- orphaned: record.orphanedAt,
1266
- source_file: record.sourceFile,
1267
- anchor_id: record.anchorId
1268
- };
1269
- if (record.anchorLastSeen) fields.anchor_last_seen = record.anchorLastSeen;
1270
- if (record.manualBlockId) fields.manual_block_id = record.manualBlockId;
1271
- const yaml = Object.entries(fields).map(([k, v]) => `${k}: ${formatYamlScalar2(v)}`).join("\n");
1272
- return `---
1273
- ${yaml}
1274
- ---
1275
4787
 
1276
- ${record.content}
1277
- `;
1278
- }
1279
- async function writeOrphan(record, orphanDir) {
1280
- const slug = slugifyAnchor(record.anchorId);
1281
- const dateStamp = formatDateUTC(new Date(record.orphanedAt));
1282
- const filename = `${dateStamp}_${slug}.md`;
1283
- const absPath = import_path4.default.resolve(orphanDir, filename);
1284
- await (0, import_promises2.mkdir)(orphanDir, { recursive: true });
1285
- await (0, import_promises2.writeFile)(absPath, renderOrphanFile(record), "utf8");
1286
- return absPath;
4788
+ // ../../node_modules/.pnpm/micromark-extension-gfm@3.0.0/node_modules/micromark-extension-gfm/index.js
4789
+ function gfm(options) {
4790
+ return combineExtensions([
4791
+ gfmAutolinkLiteral(),
4792
+ gfmFootnote(),
4793
+ gfmStrikethrough(options),
4794
+ gfmTable(),
4795
+ gfmTaskListItem()
4796
+ ]);
1287
4797
  }
1288
- function formatYamlScalar2(s) {
1289
- if (/[:#\-?{}[\],&*!|>'"%@`]/.test(s) || /^\s|\s$/.test(s)) {
1290
- return `'${s.replace(/'/g, "''")}'`;
1291
- }
1292
- return s;
4798
+
4799
+ // ../../node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js
4800
+ var emptyOptions2 = {};
4801
+ function remarkGfm(options) {
4802
+ const self = (
4803
+ /** @type {Processor<Root>} */
4804
+ this
4805
+ );
4806
+ const settings = options || emptyOptions2;
4807
+ const data = self.data();
4808
+ const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
4809
+ const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
4810
+ const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
4811
+ micromarkExtensions.push(gfm(settings));
4812
+ fromMarkdownExtensions.push(gfmFromMarkdown());
4813
+ toMarkdownExtensions.push(gfmToMarkdown(settings));
1293
4814
  }
1294
4815
 
1295
4816
  // ../site/dist/index.js
1296
- var import_fs2 = require("fs");
1297
- var import_promises3 = require("fs/promises");
1298
- var import_path5 = __toESM(require("path"), 1);
1299
- var import_url = require("url");
1300
- var import_gray_matter2 = __toESM(require("gray-matter"), 1);
1301
- var import_unified = require("unified");
1302
- var import_remark_parse = __toESM(require("remark-parse"), 1);
1303
4817
  var import_remark_rehype = __toESM(require("remark-rehype"), 1);
1304
4818
  var import_rehype_raw = __toESM(require("rehype-raw"), 1);
1305
4819
  var import_rehype_sanitize = __toESM(require("rehype-sanitize"), 1);
1306
4820
  var import_rehype_slug = __toESM(require("rehype-slug"), 1);
1307
4821
  var import_rehype_autolink_headings = __toESM(require("rehype-autolink-headings"), 1);
1308
4822
  var import_rehype_stringify = __toESM(require("rehype-stringify"), 1);
1309
- var import_unist_util_visit = require("unist-util-visit");
4823
+ var import_unist_util_visit2 = require("unist-util-visit");
1310
4824
  var import_shiki = require("shiki");
1311
4825
  var import_promises4 = require("fs/promises");
1312
4826
  var import_path6 = __toESM(require("path"), 1);
@@ -1318,15 +4832,18 @@ var pagefind = __toESM(require("pagefind"), 1);
1318
4832
  var import_check = __toESM(require("lucide/dist/esm/icons/check.mjs"), 1);
1319
4833
  var import_chevron_down = __toESM(require("lucide/dist/esm/icons/chevron-down.mjs"), 1);
1320
4834
  var import_external_link = __toESM(require("lucide/dist/esm/icons/external-link.mjs"), 1);
4835
+ var import_mail = __toESM(require("lucide/dist/esm/icons/mail.mjs"), 1);
1321
4836
  var import_menu = __toESM(require("lucide/dist/esm/icons/menu.mjs"), 1);
1322
4837
  var import_monitor = __toESM(require("lucide/dist/esm/icons/monitor.mjs"), 1);
1323
4838
  var import_moon = __toESM(require("lucide/dist/esm/icons/moon.mjs"), 1);
4839
+ var import_package = __toESM(require("lucide/dist/esm/icons/package.mjs"), 1);
4840
+ var import_rss = __toESM(require("lucide/dist/esm/icons/rss.mjs"), 1);
1324
4841
  var import_search = __toESM(require("lucide/dist/esm/icons/search.mjs"), 1);
1325
4842
  var import_sun = __toESM(require("lucide/dist/esm/icons/sun.mjs"), 1);
1326
4843
  var import_x = __toESM(require("lucide/dist/esm/icons/x.mjs"), 1);
1327
4844
  var import_unified2 = require("unified");
1328
4845
  var import_remark_parse2 = __toESM(require("remark-parse"), 1);
1329
- var import_unist_util_visit2 = require("unist-util-visit");
4846
+ var import_unist_util_visit3 = require("unist-util-visit");
1330
4847
  var import_meta = {};
1331
4848
  var CODE_THEME_PAIRS = {
1332
4849
  github: { light: "github-light", dark: "github-dark" },
@@ -1375,7 +4892,7 @@ async function renderMarkdown(md, opts = {}) {
1375
4892
  const highlighter = await getHighlighter();
1376
4893
  const themes = CODE_THEME_PAIRS[opts.codeTheme ?? "github"] ?? CODE_THEME_PAIRS.github;
1377
4894
  const headings = [];
1378
- const file = await (0, import_unified.unified)().use(import_remark_parse.default).use(import_remark_rehype.default, { allowDangerousHtml: true }).use(import_rehype_raw.default).use(import_rehype_sanitize.default, SANITIZE_SCHEMA).use(import_rehype_slug.default).use(import_rehype_autolink_headings.default, {
4895
+ const file = await (0, import_unified.unified)().use(import_remark_parse.default).use(remarkGfm).use(import_remark_rehype.default, { allowDangerousHtml: true }).use(import_rehype_raw.default).use(import_rehype_sanitize.default, SANITIZE_SCHEMA).use(rehypeCallouts).use(rehypeTableWrap).use(import_rehype_slug.default).use(import_rehype_autolink_headings.default, {
1379
4896
  // `append` keeps the heading text flush-left along with the prose;
1380
4897
  // the `#` indicator floats in after the text on hover (see styles).
1381
4898
  behavior: "append",
@@ -1387,29 +4904,103 @@ async function renderMarkdown(md, opts = {}) {
1387
4904
  }).use(import_rehype_stringify.default, { allowDangerousHtml: true }).process(md);
1388
4905
  return { html: String(file), headings };
1389
4906
  }
4907
+ function rehypeTableWrap() {
4908
+ return (tree) => {
4909
+ (0, import_unist_util_visit2.visit)(tree, "element", (node2, index, parent) => {
4910
+ if (node2.tagName !== "table") return;
4911
+ if (!parent || typeof index !== "number") return;
4912
+ if (parent.type === "element" && readClassNames(parent).includes("ov-table-wrap")) {
4913
+ return;
4914
+ }
4915
+ const wrapper = {
4916
+ type: "element",
4917
+ tagName: "div",
4918
+ properties: { className: ["ov-table-wrap"] },
4919
+ children: [node2]
4920
+ };
4921
+ parent.children[index] = wrapper;
4922
+ });
4923
+ };
4924
+ }
4925
+ var CALLOUT_RE = /^\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\][^\S\n]*\n?/i;
4926
+ var CALLOUT_LABEL = {
4927
+ note: "Note",
4928
+ tip: "Tip",
4929
+ important: "Important",
4930
+ warning: "Warning",
4931
+ caution: "Caution"
4932
+ };
4933
+ function rehypeCallouts() {
4934
+ return (tree) => {
4935
+ (0, import_unist_util_visit2.visit)(tree, "element", (node2) => {
4936
+ if (node2.tagName !== "blockquote") return;
4937
+ const firstP = node2.children.find(
4938
+ (c) => c.type === "element" && c.tagName === "p"
4939
+ );
4940
+ if (!firstP) return;
4941
+ const firstText = firstP.children[0];
4942
+ if (!firstText || firstText.type !== "text") return;
4943
+ const m = CALLOUT_RE.exec(firstText.value);
4944
+ if (!m) return;
4945
+ const type = m[1].toLowerCase();
4946
+ firstText.value = firstText.value.slice(m[0].length);
4947
+ const stripped = firstText.value.replace(/^\s+/, "");
4948
+ if (firstP.children.length === 1 && firstText.type === "text" && stripped.length === 0) {
4949
+ node2.children = node2.children.filter((c) => c !== firstP);
4950
+ } else {
4951
+ firstText.value = stripped;
4952
+ }
4953
+ node2.tagName = "div";
4954
+ node2.properties = {
4955
+ ...node2.properties ?? {},
4956
+ className: ["ov-callout", `ov-callout--${type}`]
4957
+ };
4958
+ const label = {
4959
+ type: "element",
4960
+ tagName: "div",
4961
+ properties: { className: ["ov-callout-label"] },
4962
+ children: [{ type: "text", value: CALLOUT_LABEL[type] }]
4963
+ };
4964
+ node2.children = [label, ...node2.children];
4965
+ });
4966
+ };
4967
+ }
1390
4968
  function collectHeadings(tree, into) {
1391
- (0, import_unist_util_visit.visit)(tree, "element", (node) => {
1392
- if (!/^h[2-3]$/.test(node.tagName)) return;
1393
- const depth = Number(node.tagName.slice(1));
1394
- const id = typeof node.properties?.id === "string" ? node.properties.id : "";
4969
+ (0, import_unist_util_visit2.visit)(tree, "element", (node2) => {
4970
+ if (!/^h[2-3]$/.test(node2.tagName)) return;
4971
+ const depth = Number(node2.tagName.slice(1));
4972
+ const id = typeof node2.properties?.id === "string" ? node2.properties.id : "";
1395
4973
  if (!id) return;
1396
- const text = textOf(node).replace(/^#/, "").trim();
1397
- into.push({ depth, text, id });
4974
+ const text3 = textOfHeading(node2).trim();
4975
+ into.push({ depth, text: text3, id });
1398
4976
  });
1399
4977
  }
4978
+ function textOfHeading(node2) {
4979
+ let out = "";
4980
+ for (const child of node2.children) {
4981
+ if (child.type === "text") {
4982
+ out += child.value;
4983
+ } else if (child.type === "element") {
4984
+ const classNames = readClassNames(child);
4985
+ if (classNames.includes("heading-anchor")) continue;
4986
+ out += textOf(child);
4987
+ }
4988
+ }
4989
+ return out;
4990
+ }
1400
4991
  function highlightCodeBlocks(tree, highlighter, themes) {
1401
- (0, import_unist_util_visit.visit)(tree, "element", (node, index, parent) => {
1402
- if (node.tagName !== "pre" || !parent || typeof index !== "number" || !node.children?.length) {
4992
+ (0, import_unist_util_visit2.visit)(tree, "element", (node2, index, parent) => {
4993
+ if (node2.tagName !== "pre" || !parent || typeof index !== "number" || !node2.children?.length) {
1403
4994
  return;
1404
4995
  }
1405
- const code = node.children.find(
4996
+ const code3 = node2.children.find(
1406
4997
  (c) => c.type === "element" && c.tagName === "code"
1407
4998
  );
1408
- if (!code) return;
1409
- const langClass = readClassNames(code).find((c) => c.startsWith("language-"));
4999
+ if (!code3) return;
5000
+ const langClass = readClassNames(code3).find((c) => c.startsWith("language-"));
1410
5001
  const lang = langClass ? langClass.slice("language-".length) : "text";
1411
5002
  if (!SHIKI_LANGS.includes(lang)) return;
1412
- const source = textOf(code);
5003
+ const source = textOf(code3);
1413
5004
  const hast = highlighter.codeToHast(source, {
1414
5005
  lang,
1415
5006
  themes,
@@ -1417,48 +5008,66 @@ function highlightCodeBlocks(tree, highlighter, themes) {
1417
5008
  });
1418
5009
  const replacement = hast.children[0];
1419
5010
  if (!replacement || replacement.type !== "element") return;
5011
+ replacement.properties = {
5012
+ ...replacement.properties ?? {},
5013
+ "data-language": LANG_LABEL[lang] ?? lang,
5014
+ "data-copy": "true"
5015
+ };
1420
5016
  parent.children[index] = replacement;
1421
5017
  });
1422
5018
  }
1423
- function readClassNames(node) {
1424
- const cn = node.properties?.className;
5019
+ var LANG_LABEL = {
5020
+ typescript: "ts",
5021
+ tsx: "tsx",
5022
+ javascript: "js",
5023
+ jsx: "jsx",
5024
+ json: "json",
5025
+ bash: "bash",
5026
+ shell: "shell",
5027
+ markdown: "md",
5028
+ yaml: "yaml",
5029
+ html: "html",
5030
+ css: "css"
5031
+ };
5032
+ function readClassNames(node2) {
5033
+ const cn = node2.properties?.className;
1425
5034
  if (Array.isArray(cn)) return cn.filter((c) => typeof c === "string");
1426
5035
  if (typeof cn === "string") return cn.split(/\s+/);
1427
5036
  return [];
1428
5037
  }
1429
- function textOf(node) {
5038
+ function textOf(node2) {
1430
5039
  let out = "";
1431
- for (const child of node.children) {
5040
+ for (const child of node2.children) {
1432
5041
  if (child.type === "text") out += child.value;
1433
5042
  else if (child.type === "element") out += textOf(child);
1434
5043
  }
1435
5044
  return out;
1436
5045
  }
1437
- function flattenNav(root) {
5046
+ function flattenNav(root2) {
1438
5047
  const out = [];
1439
- function walk2(node) {
1440
- if (node.sourcePath !== void 0) out.push(node);
1441
- for (const child of node.children) walk2(child);
5048
+ function walk2(node2) {
5049
+ if (node2.sourcePath !== void 0) out.push(node2);
5050
+ for (const child of node2.children) walk2(child);
1442
5051
  }
1443
- walk2(root);
5052
+ walk2(root2);
1444
5053
  return out;
1445
5054
  }
1446
- function findBreadcrumbs(root, url) {
5055
+ function findBreadcrumbs(root2, url) {
1447
5056
  const path32 = [];
1448
- function walk2(node) {
1449
- path32.push(node);
1450
- if (node.url === url) return true;
1451
- for (const child of node.children) {
5057
+ function walk2(node2) {
5058
+ path32.push(node2);
5059
+ if (node2.url === url) return true;
5060
+ for (const child of node2.children) {
1452
5061
  if (walk2(child)) return true;
1453
5062
  }
1454
5063
  path32.pop();
1455
5064
  return false;
1456
5065
  }
1457
- walk2(root);
5066
+ walk2(root2);
1458
5067
  return path32;
1459
5068
  }
1460
- function findAdjacent(root, url) {
1461
- const flat = flattenNav(root);
5069
+ function findAdjacent(root2, url) {
5070
+ const flat = flattenNav(root2);
1462
5071
  const idx = flat.findIndex((p) => p.url === url);
1463
5072
  if (idx === -1) return {};
1464
5073
  return {
@@ -1544,8 +5153,8 @@ function applyOrdering(children, meta) {
1544
5153
  }
1545
5154
  children.sort((a, b) => a.title.localeCompare(b.title));
1546
5155
  }
1547
- function slugOf(node) {
1548
- const trimmed = node.url.replace(/\/+$/, "");
5156
+ function slugOf(node2) {
5157
+ const trimmed = node2.url.replace(/\/+$/, "");
1549
5158
  return trimmed.slice(trimmed.lastIndexOf("/") + 1);
1550
5159
  }
1551
5160
  function isMarkdown(name) {
@@ -1613,13 +5222,66 @@ async function indexSite(input2) {
1613
5222
  errors: writeRes.errors
1614
5223
  };
1615
5224
  }
1616
- function generateSitemap(input2) {
5225
+ function generateRss(input2) {
1617
5226
  if (!input2.baseUrl) return void 0;
1618
5227
  const base = stripTrailingSlash(input2.baseUrl);
1619
5228
  const prefix = input2.basePath ? stripTrailingSlash(input2.basePath) : "";
1620
5229
  const exclude = new Set(input2.exclude ?? ["/404/"]);
5230
+ const limit = input2.limit ?? 20;
5231
+ const generatedAt = input2.generatedAt ?? /* @__PURE__ */ new Date();
5232
+ const homeLink = base + (prefix || "/");
5233
+ const selfLink = base + prefix + "/feed.xml";
5234
+ const items = input2.pages.filter((p) => !exclude.has(p.url)).sort((a, b) => compareLastMod(a.lastModified, b.lastModified)).slice(0, limit).map((p) => renderItem(p, base + prefix));
5235
+ const channelDesc = input2.description ? escapeXml(input2.description) : "";
5236
+ return `<?xml version="1.0" encoding="UTF-8"?>
5237
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
5238
+ <channel>
5239
+ <title>${escapeXml(input2.title)}</title>
5240
+ <link>${escapeXml(homeLink)}</link>
5241
+ <description>${channelDesc}</description>
5242
+ <atom:link href="${escapeXml(selfLink)}" rel="self" type="application/rss+xml" />
5243
+ <lastBuildDate>${toRfc822(generatedAt)}</lastBuildDate>
5244
+ ${items.join("\n")}
5245
+ </channel>
5246
+ </rss>
5247
+ `;
5248
+ }
5249
+ function renderItem(page, baseWithPrefix) {
5250
+ const link2 = baseWithPrefix + page.url;
5251
+ const pubDate = page.lastModified ? toRfc822(new Date(page.lastModified)) : void 0;
5252
+ const lines = [
5253
+ " <item>",
5254
+ ` <title>${escapeXml(page.title)}</title>`,
5255
+ ` <link>${escapeXml(link2)}</link>`,
5256
+ ` <guid isPermaLink="true">${escapeXml(link2)}</guid>`,
5257
+ ` <description>${page.description ? escapeXml(page.description) : ""}</description>`
5258
+ ];
5259
+ if (pubDate) lines.push(` <pubDate>${pubDate}</pubDate>`);
5260
+ lines.push(" </item>");
5261
+ return lines.join("\n");
5262
+ }
5263
+ function compareLastMod(a, b) {
5264
+ if (a && b) return b.localeCompare(a);
5265
+ if (a && !b) return -1;
5266
+ if (!a && b) return 1;
5267
+ return 0;
5268
+ }
5269
+ function toRfc822(d) {
5270
+ return d.toUTCString();
5271
+ }
5272
+ function stripTrailingSlash(s) {
5273
+ return s.replace(/\/+$/, "");
5274
+ }
5275
+ function escapeXml(s) {
5276
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
5277
+ }
5278
+ function generateSitemap(input2) {
5279
+ if (!input2.baseUrl) return void 0;
5280
+ const base = stripTrailingSlash2(input2.baseUrl);
5281
+ const prefix = input2.basePath ? stripTrailingSlash2(input2.basePath) : "";
5282
+ const exclude = new Set(input2.exclude ?? ["/404/"]);
1621
5283
  const entries = input2.pages.filter((p) => !exclude.has(p.url)).map((p) => ` <url>
1622
- <loc>${escapeXml(base + prefix + p.url)}</loc>
5284
+ <loc>${escapeXml2(base + prefix + p.url)}</loc>
1623
5285
  </url>`).join("\n");
1624
5286
  return `<?xml version="1.0" encoding="UTF-8"?>
1625
5287
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@@ -1627,10 +5289,10 @@ ${entries}
1627
5289
  </urlset>
1628
5290
  `;
1629
5291
  }
1630
- function stripTrailingSlash(s) {
5292
+ function stripTrailingSlash2(s) {
1631
5293
  return s.replace(/\/+$/, "");
1632
5294
  }
1633
- function escapeXml(s) {
5295
+ function escapeXml2(s) {
1634
5296
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1635
5297
  }
1636
5298
  var GITHUB_MARK = [
@@ -1652,7 +5314,10 @@ var REGISTRY = {
1652
5314
  github: GITHUB_MARK,
1653
5315
  "external-link": import_external_link.default,
1654
5316
  search: import_search.default,
1655
- check: import_check.default
5317
+ check: import_check.default,
5318
+ rss: import_rss.default,
5319
+ mail: import_mail.default,
5320
+ package: import_package.default
1656
5321
  };
1657
5322
  var ICONS = Object.fromEntries(
1658
5323
  Object.keys(REGISTRY).map((name) => [name, nodesToInnerHtml(REGISTRY[name])])
@@ -1668,8 +5333,8 @@ function renderIcon(name, opts = {}) {
1668
5333
  function nodesToInnerHtml(nodes) {
1669
5334
  return nodes.map(nodeToHtml).join("");
1670
5335
  }
1671
- function nodeToHtml(node) {
1672
- const [tag, attrs, children] = node;
5336
+ function nodeToHtml(node2) {
5337
+ const [tag, attrs, children] = node2;
1673
5338
  const attrStr = Object.entries(attrs).map(([k, v]) => `${k}="${escapeAttr(String(v))}"`).join(" ");
1674
5339
  const inner = children && children.length > 0 ? nodesToInnerHtml(children) : "";
1675
5340
  return inner ? `<${tag} ${attrStr}>${inner}</${tag}>` : `<${tag} ${attrStr}/>`;
@@ -1716,9 +5381,18 @@ function renderShell(opts) {
1716
5381
  <head>
1717
5382
  <meta charset="utf-8">
1718
5383
  <meta name="viewport" content="width=device-width, initial-scale=1">
5384
+ <!-- Drives Safari's URL bar tint and the top-of-page rubber-band area.
5385
+ data-light / data-dark are hex approximations of --color-bg
5386
+ (body) in light + dark \u2014 the topbar now reads as a continuation
5387
+ of the body, so the URL bar should match body, not chrome.
5388
+ Update these if --color-bg moves. The inline boot script below
5389
+ picks the right one before paint, and script.js keeps it in
5390
+ sync with the theme toggle + OS changes. -->
5391
+ <meta name="theme-color" id="ov-theme-color" data-light="#f4f4f4" data-dark="#101010" content="#f4f4f4">
1719
5392
  <title>${escapeHtml(opts.fullTitle)}</title>
1720
5393
  ${desc ? `<meta name="description" content="${escapeAttr2(desc)}">` : ""}
1721
5394
  ${opts.site.baseUrl ? `<link rel="canonical" href="${escapeAttr2(join(opts.site.baseUrl, basePath + opts.url))}">` : ""}
5395
+ ${opts.site.baseUrl ? `<link rel="alternate" type="application/rss+xml" title="${escapeAttr2(opts.site.title)}" href="${escapeAttr2(join(opts.site.baseUrl, basePath + "/feed.xml"))}">` : ""}
1722
5396
  <link rel="stylesheet" href="${escapeAttr2(assets)}assets/ovellum.css">
1723
5397
  ${searchHead}
1724
5398
  <script>
@@ -1727,6 +5401,16 @@ function renderShell(opts) {
1727
5401
  var t = localStorage.getItem('ovellum-theme');
1728
5402
  if (t === 'light' || t === 'dark' || t === 'auto') {
1729
5403
  document.documentElement.setAttribute('data-theme', t);
5404
+ } else {
5405
+ t = document.documentElement.getAttribute('data-theme') || 'auto';
5406
+ }
5407
+ var effective = t;
5408
+ if (t === 'auto') {
5409
+ effective = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
5410
+ }
5411
+ var meta = document.getElementById('ov-theme-color');
5412
+ if (meta) {
5413
+ meta.setAttribute('content', meta.getAttribute(effective === 'dark' ? 'data-dark' : 'data-light'));
1730
5414
  }
1731
5415
  } catch (_) {}
1732
5416
  })();
@@ -1735,28 +5419,47 @@ function renderShell(opts) {
1735
5419
  <body${opts.bodyClass ? ` class="${escapeAttr2(opts.bodyClass)}"` : ""}>
1736
5420
  ${renderTopbar(opts.site, assets, opts.docsHref ? siteUrl(opts.docsHref, basePath) : void 0, searchEnabled, basePath)}
1737
5421
  ${opts.body}
1738
- ${renderFooter(opts.site, opts.generatedAt)}
5422
+ ${renderFooter(opts.site, opts.generatedAt, basePath)}
1739
5423
  ${searchScripts}
1740
5424
  <script src="${escapeAttr2(assets)}assets/ovellum.js" defer></script>
1741
5425
  </body>
1742
5426
  </html>
1743
5427
  `;
1744
5428
  }
1745
- function renderTopbar(site, assets, docsHref, searchEnabled, basePath) {
1746
- const navItems = site.topbarNav ?? [];
1747
- const items = navItems.map((item) => {
5429
+ var BRAND_MARK = `<svg class="ov-brand-mark" width="24" height="24" viewBox="0 0 3334 3334" fill="currentColor" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M1610.79,192.942l-603.283,-0.069c-72.722,290.674 -294.48,871.657 -294.48,871.657c-53.158,128.398 -37.404,275.067 41.795,389.217l743.687,1149.95l0,233.06c-42.509,41.505 -68.98,99.335 -68.98,163.352c-0.069,126.096 102.07,228.236 228.167,228.167c126.096,0.069 228.308,-102.144 228.235,-228.236c-0,-64.017 -26.471,-121.847 -68.985,-163.21l0,-233.06l743.765,-1150.03c79.122,-114.228 94.806,-260.819 41.722,-389.143c0,-0 -221.472,-580.983 -294.052,-871.652l-603.352,0l-94.239,-0.005Zm323.188,921.357c0,140.409 -104.731,256.078 -240.177,273.7l0,1386.96c-11.868,-1.795 -23.809,-3.093 -36.036,-3.093c-12.375,-0 -24.243,1.224 -36.037,3.093l-0,-1386.97c-135.593,-17.623 -240.251,-133.218 -240.251,-273.627c0,-152.635 123.652,-276.287 276.288,-276.287c152.635,0 276.282,123.656 276.213,276.223Z"/></svg>`;
5430
+ function resolveTopbarItems(site, basePath) {
5431
+ return (site.topbarNav ?? []).map((item) => {
1748
5432
  const external = item.external === true || /^https?:\/\//i.test(item.href);
1749
- const href = external ? item.href : siteUrl(item.href, basePath);
5433
+ const icon = item.icon && item.icon in ICONS ? item.icon : void 0;
5434
+ return {
5435
+ label: item.label,
5436
+ href: external ? item.href : siteUrl(item.href, basePath),
5437
+ external,
5438
+ icon
5439
+ };
5440
+ });
5441
+ }
5442
+ function renderTopbarLinks(items, docsHref, compact) {
5443
+ const links = items.map(({ label, href, external, icon }) => {
1750
5444
  const rel = external ? ' rel="noopener" target="_blank"' : "";
1751
- const icon = external ? ` ${renderIcon("external-link", { class: "ov-topbar-icon", size: 14 })}` : "";
1752
- return `<a class="ov-topbar-link" href="${escapeAttr2(href)}"${rel}>${escapeHtml(item.label)}${icon}</a>`;
5445
+ if (icon && compact) {
5446
+ return `<a class="ov-topbar-link ov-topbar-link--icon" href="${escapeAttr2(href)}"${rel} aria-label="${escapeAttr2(label)}" title="${escapeAttr2(label)}">${renderIcon(icon, { class: "ov-topbar-glyph", size: 18 })}<span class="ov-sr-only">${escapeHtml(label)}</span></a>`;
5447
+ }
5448
+ const glyph = icon ? `${renderIcon(icon, { class: "ov-topbar-glyph", size: 18 })}` : "";
5449
+ const ext = external && !icon ? ` ${renderIcon("external-link", { class: "ov-topbar-icon", size: 14 })}` : "";
5450
+ return `<a class="ov-topbar-link" href="${escapeAttr2(href)}"${rel}>${glyph}${escapeHtml(label)}${ext}</a>`;
1753
5451
  });
1754
- if (docsHref) {
1755
- items.push(
5452
+ if (docsHref && !items.some((it) => it.href === docsHref)) {
5453
+ links.push(
1756
5454
  `<a class="ov-topbar-link ov-topbar-link--docs" href="${escapeAttr2(docsHref)}">Docs</a>`
1757
5455
  );
1758
5456
  }
1759
- const navLinks = items.join("\n ");
5457
+ return links.join("\n ");
5458
+ }
5459
+ function renderTopbar(site, assets, docsHref, searchEnabled, basePath) {
5460
+ const items = resolveTopbarItems(site, basePath);
5461
+ const desktopLinks = renderTopbarLinks(items, docsHref, true);
5462
+ const mobileLinks = renderTopbarLinks(items, docsHref, false);
1760
5463
  const search = searchEnabled ? `<div id="ov-search" class="ov-search"></div>` : "";
1761
5464
  const menuButton = `<button class="ov-topbar-menu" type="button"
1762
5465
  aria-label="Open menu" aria-expanded="false" aria-controls="ov-mobile-nav"
@@ -1770,22 +5473,46 @@ function renderTopbar(site, assets, docsHref, searchEnabled, basePath) {
1770
5473
  <span class="ov-theme-icon ov-theme-icon-light">${renderIcon("sun")}</span>
1771
5474
  <span class="ov-theme-icon ov-theme-icon-dark">${renderIcon("moon")}</span>
1772
5475
  </button>`;
5476
+ const versionBadge = site.version ? `<span class="ov-brand-version" aria-label="Stable version ${escapeAttr2(site.version)}">${escapeHtml(site.version)}</span>` : "";
1773
5477
  return `<header class="ov-topbar">
1774
- <a class="ov-brand" href="${escapeAttr2(assets)}">${escapeHtml(site.title)}</a>
1775
- <nav class="ov-topbar-nav" aria-label="Primary">${navLinks}</nav>
1776
- <div class="ov-topbar-right">
1777
- ${search}
1778
- ${themeButton}
1779
- ${menuButton}
5478
+ <div class="ov-topbar-inner">
5479
+ <div class="ov-brand-row">
5480
+ <a class="ov-brand" href="${escapeAttr2(assets)}">${BRAND_MARK}<span class="ov-brand-name">${escapeHtml(site.title)}</span></a>
5481
+ ${versionBadge}
5482
+ </div>
5483
+ <div class="ov-topbar-search">${search}</div>
5484
+ <div class="ov-topbar-right">
5485
+ <nav class="ov-topbar-nav" aria-label="Primary">${desktopLinks}</nav>
5486
+ ${themeButton}
5487
+ ${menuButton}
5488
+ </div>
5489
+ <nav id="ov-mobile-nav" class="ov-mobile-nav" aria-label="Mobile">
5490
+ ${mobileLinks}
5491
+ <div class="ov-mobile-theme">
5492
+ <span class="ov-mobile-theme-label">Theme</span>
5493
+ ${themeButton}
5494
+ </div>
5495
+ </nav>
1780
5496
  </div>
1781
- <nav id="ov-mobile-nav" class="ov-mobile-nav" aria-label="Mobile">
1782
- ${navLinks}
1783
- </nav>
1784
5497
  </header>`;
1785
5498
  }
1786
- function renderFooter(site, generatedAt) {
1787
- if (!site.footer) return "";
1788
- return `<footer class="ov-footer"><span>${escapeHtml(site.footer)}</span><span class="ov-footer-sep"> \xB7 </span><time datetime="${escapeAttr2(generatedAt)}">${escapeHtml(generatedAt.slice(0, 10))}</time></footer>`;
5499
+ function renderFooter(site, generatedAt, basePath) {
5500
+ const items = site.footerNav ?? [];
5501
+ const hasItems = items.length > 0;
5502
+ if (!site.footer && !hasItems) return "";
5503
+ const left = site.footer ? `<div class="ov-footer-left"><span>${escapeHtml(site.footer)}</span><span class="ov-footer-sep">\xB7</span><time datetime="${escapeAttr2(generatedAt)}">${escapeHtml(generatedAt.slice(0, 10))}</time></div>` : '<div class="ov-footer-left"></div>';
5504
+ const right = hasItems ? `<nav class="ov-footer-right" aria-label="Site links">${items.map((item) => renderFooterNavItem(item, basePath)).join("")}</nav>` : "";
5505
+ return `<footer class="ov-footer"><div class="ov-footer-inner">${left}${right}</div></footer>`;
5506
+ }
5507
+ function renderFooterNavItem(item, basePath) {
5508
+ const external = item.external === true || /^https?:\/\//i.test(item.href);
5509
+ const href = external ? item.href : siteUrl(item.href, basePath);
5510
+ const rel = external ? ' rel="noopener" target="_blank"' : "";
5511
+ const iconName = item.icon;
5512
+ if (iconName && iconName in ICONS) {
5513
+ return `<a class="ov-footer-link ov-footer-link--icon" href="${escapeAttr2(href)}"${rel} aria-label="${escapeAttr2(item.label)}" title="${escapeAttr2(item.label)}">${renderIcon(iconName, { class: "ov-footer-icon", size: 18 })}<span class="ov-sr-only">${escapeHtml(item.label)}</span></a>`;
5514
+ }
5515
+ return `<a class="ov-footer-link" href="${escapeAttr2(href)}"${rel}>${escapeHtml(item.label)}</a>`;
1789
5516
  }
1790
5517
  function renderPage(input2) {
1791
5518
  const fullTitle = input2.title && input2.title !== input2.site.title ? `${input2.title} \xB7 ${input2.site.title}` : input2.site.title;
@@ -1827,16 +5554,26 @@ function renderLanding(input2) {
1827
5554
  heroTitle,
1828
5555
  input2.landing.hero.subtitle,
1829
5556
  input2.landing.hero.ctas,
5557
+ input2.landing.hero.media,
1830
5558
  basePath
1831
5559
  );
1832
5560
  const features = renderFeatures(input2.landing.features);
1833
5561
  const pitch = input2.pitchHtml ? `<section class="ov-pitch"><div class="ov-pitch-inner">${input2.pitchHtml}</div></section>` : "";
1834
5562
  const trust = renderTrustStrip(input2.landing.trustStrip);
5563
+ const sections = [hero, features, pitch, trust].filter((s) => s !== "");
5564
+ const scenes = input2.landing.scenes ?? [];
5565
+ const interleaved = [];
5566
+ sections.forEach((section, i) => {
5567
+ interleaved.push(section);
5568
+ if (i < sections.length - 1 && scenes[i]) {
5569
+ interleaved.push(renderScene(scenes[i], i, basePath));
5570
+ }
5571
+ });
5572
+ scenes.slice(Math.max(0, sections.length - 1)).forEach((sc, j) => {
5573
+ interleaved.push(renderScene(sc, sections.length - 1 + j, basePath));
5574
+ });
1835
5575
  const body = `<main class="ov-landing">
1836
- ${hero}
1837
- ${features}
1838
- ${pitch}
1839
- ${trust}
5576
+ ${interleaved.join("\n ")}
1840
5577
  </main>`;
1841
5578
  return renderShell({
1842
5579
  site: input2.site,
@@ -1850,7 +5587,7 @@ function renderLanding(input2) {
1850
5587
  bodyClass: "ov-body-landing"
1851
5588
  });
1852
5589
  }
1853
- function renderHero(title, subtitle, ctas, basePath) {
5590
+ function renderHero(title, subtitle, ctas, media, basePath) {
1854
5591
  const ctaButtons = ctas.map((cta, i) => {
1855
5592
  const style = cta.style ?? (i === 0 ? "primary" : "secondary");
1856
5593
  return `<a class="ov-cta ov-cta--${escapeAttr2(style)}" href="${escapeAttr2(siteUrl(cta.href, basePath))}">${escapeHtml(cta.label)}</a>`;
@@ -1858,17 +5595,42 @@ function renderHero(title, subtitle, ctas, basePath) {
1858
5595
  const ctaRow = ctas.length > 0 ? `<div class="ov-cta-row">
1859
5596
  ${ctaButtons}
1860
5597
  </div>` : "";
1861
- return `<section class="ov-hero">
1862
- <h1 class="ov-hero-title">${escapeHtml(title)}</h1>
1863
- ${subtitle ? `<p class="ov-hero-subtitle">${escapeHtml(subtitle)}</p>` : ""}
1864
- ${ctaRow}
5598
+ const art = media ? renderHeroArt(media, basePath) : "";
5599
+ const sectionAttrs = media ? " data-media" : "";
5600
+ return `<section class="ov-hero"${sectionAttrs}>
5601
+ ${art}
5602
+ <div class="ov-hero-inner">
5603
+ <h1 class="ov-hero-title">${escapeHtml(title)}</h1>
5604
+ ${subtitle ? `<p class="ov-hero-subtitle">${escapeHtml(subtitle)}</p>` : ""}
5605
+ ${ctaRow}
5606
+ </div>
1865
5607
  </section>`;
1866
5608
  }
5609
+ function renderHeroArt(media, basePath) {
5610
+ const alt = media.alt ?? "";
5611
+ const lightSrc = escapeAttr2(siteUrl(media.light, basePath));
5612
+ const darkSrc = media.dark ? escapeAttr2(siteUrl(media.dark, basePath)) : lightSrc;
5613
+ return `<div class="ov-hero-art" aria-hidden="${alt ? "false" : "true"}">
5614
+ <img class="ov-hero-art-img ov-hero-art-img--light" src="${lightSrc}" alt="${escapeAttr2(alt)}" loading="eager" decoding="async">
5615
+ <img class="ov-hero-art-img ov-hero-art-img--dark" src="${darkSrc}" alt="" loading="eager" decoding="async">
5616
+ </div>`;
5617
+ }
5618
+ function renderScene(scene, index, basePath) {
5619
+ const alt = scene.alt ?? "";
5620
+ const lightSrc = escapeAttr2(siteUrl(scene.light, basePath));
5621
+ const darkSrc = scene.dark ? escapeAttr2(siteUrl(scene.dark, basePath)) : lightSrc;
5622
+ return `<section class="ov-scene" aria-hidden="${alt ? "false" : "true"}" style="--ov-scene-i: ${index};">
5623
+ <figure class="ov-scene-art">
5624
+ <img class="ov-scene-img ov-scene-img--light" src="${lightSrc}" alt="${escapeAttr2(alt)}" loading="lazy" decoding="async">
5625
+ <img class="ov-scene-img ov-scene-img--dark" src="${darkSrc}" alt="" loading="lazy" decoding="async">
5626
+ </figure>
5627
+ </section>`;
5628
+ }
1867
5629
  function renderFeatures(features) {
1868
5630
  if (features.length === 0) return "";
1869
5631
  const cards = features.map((f) => {
1870
5632
  const icon = f.icon ? `<div class="ov-feature-icon" aria-hidden="true">${f.icon}</div>` : "";
1871
- return `<article class="ov-feature-card">
5633
+ return `<article class="ov-card ov-feature-card">
1872
5634
  ${icon}
1873
5635
  <h3 class="ov-feature-title">${escapeHtml(f.title)}</h3>
1874
5636
  <p class="ov-feature-description">${escapeHtml(f.description)}</p>
@@ -1898,23 +5660,23 @@ function renderSidebar(nav, activeUrl, basePath) {
1898
5660
  }
1899
5661
  function navList(nodes, activeUrl, basePath) {
1900
5662
  if (nodes.length === 0) return "";
1901
- return nodes.map((node) => {
1902
- const isActive = node.url === activeUrl;
1903
- const hasChildren = node.children.length > 0;
1904
- const link = node.sourcePath ? `<a class="ov-nav-link${isActive ? " is-active" : ""}" href="${escapeAttr2(siteUrl(node.url, basePath))}">${escapeHtml(node.title)}</a>` : `<span class="ov-nav-group">${escapeHtml(node.title)}</span>`;
1905
- const children = hasChildren ? `<ul class="ov-nav-children">${navList(node.children, activeUrl, basePath)}</ul>` : "";
1906
- return `<li>${link}${children}</li>`;
5663
+ return nodes.map((node2) => {
5664
+ const isActive = node2.url === activeUrl;
5665
+ const hasChildren = node2.children.length > 0;
5666
+ const link2 = node2.sourcePath ? `<a class="ov-nav-link${isActive ? " is-active" : ""}" href="${escapeAttr2(siteUrl(node2.url, basePath))}">${escapeHtml(node2.title)}</a>` : `<span class="ov-nav-group">${escapeHtml(node2.title)}</span>`;
5667
+ const children = hasChildren ? `<ul class="ov-nav-children">${navList(node2.children, activeUrl, basePath)}</ul>` : "";
5668
+ return `<li>${link2}${children}</li>`;
1907
5669
  }).join("");
1908
5670
  }
1909
- function renderBreadcrumbs(trail, basePath) {
1910
- if (!trail || trail.length < 3) return "";
1911
- const visible = trail.slice(1);
1912
- const items = visible.map((node, i) => {
5671
+ function renderBreadcrumbs(trail2, basePath) {
5672
+ if (!trail2 || trail2.length < 3) return "";
5673
+ const visible = trail2.slice(1);
5674
+ const items = visible.map((node2, i) => {
1913
5675
  const isLast = i === visible.length - 1;
1914
5676
  if (isLast) {
1915
- return `<li class="ov-crumb is-current" aria-current="page">${escapeHtml(node.title)}</li>`;
5677
+ return `<li class="ov-crumb is-current" aria-current="page">${escapeHtml(node2.title)}</li>`;
1916
5678
  }
1917
- return `<li class="ov-crumb"><a href="${escapeAttr2(siteUrl(node.url, basePath))}">${escapeHtml(node.title)}</a></li>`;
5679
+ return `<li class="ov-crumb"><a href="${escapeAttr2(siteUrl(node2.url, basePath))}">${escapeHtml(node2.title)}</a></li>`;
1918
5680
  }).join("\n ");
1919
5681
  return `<nav class="ov-breadcrumbs" aria-label="Breadcrumb">
1920
5682
  <ol>
@@ -1992,14 +5754,14 @@ async function buildSite(options) {
1992
5754
  let landingRendered = false;
1993
5755
  if (landingEnabled) {
1994
5756
  const landingBody = await readLandingBody(inputAbs, site);
1995
- const html = renderLanding({
5757
+ const html2 = renderLanding({
1996
5758
  site,
1997
5759
  landing: site.landing,
1998
5760
  pitchHtml: landingBody?.html,
1999
5761
  generatedAt: now.toISOString(),
2000
5762
  docsHref
2001
5763
  });
2002
- await (0, import_promises3.writeFile)(import_path5.default.join(outputAbs, "index.html"), html, "utf8");
5764
+ await (0, import_promises3.writeFile)(import_path5.default.join(outputAbs, "index.html"), html2, "utf8");
2003
5765
  pages.push({
2004
5766
  sourcePath: landingBody?.sourcePath ?? "(landing config)",
2005
5767
  outputPath: import_path5.default.relative(cwd, import_path5.default.join(outputAbs, "index.html")).replace(/\\/g, "/"),
@@ -2026,7 +5788,9 @@ async function buildSite(options) {
2026
5788
  absInput: file,
2027
5789
  url,
2028
5790
  site,
2029
- nav,
5791
+ // Sidebar renders the section subtree; prev/next + breadcrumbs above
5792
+ // still use the full nav so reading order spans the whole site.
5793
+ nav: sidebarRootFor(nav),
2030
5794
  cwd,
2031
5795
  generatedAt: now.toISOString(),
2032
5796
  docsHref,
@@ -2041,7 +5805,9 @@ async function buildSite(options) {
2041
5805
  sourcePath: import_path5.default.relative(cwd, file).replace(/\\/g, "/"),
2042
5806
  outputPath: import_path5.default.relative(cwd, outputPath).replace(/\\/g, "/"),
2043
5807
  url,
2044
- title: result.title
5808
+ title: result.title,
5809
+ description: result.description,
5810
+ lastModified: result.lastModified
2045
5811
  });
2046
5812
  warnings.push(...result.warnings);
2047
5813
  } else {
@@ -2058,9 +5824,19 @@ async function buildSite(options) {
2058
5824
  if (site.baseUrl) {
2059
5825
  const xml = generateSitemap({ pages, baseUrl: site.baseUrl, basePath: site.basePath });
2060
5826
  if (xml) await (0, import_promises3.writeFile)(import_path5.default.join(outputAbs, "sitemap.xml"), xml, "utf8");
5827
+ const rss = generateRss({
5828
+ pages,
5829
+ baseUrl: site.baseUrl,
5830
+ basePath: site.basePath,
5831
+ title: site.title,
5832
+ description: site.description,
5833
+ exclude: ["/404/", "/"],
5834
+ generatedAt: now
5835
+ });
5836
+ if (rss) await (0, import_promises3.writeFile)(import_path5.default.join(outputAbs, "feed.xml"), rss, "utf8");
2061
5837
  } else {
2062
5838
  warnings.push(
2063
- "sitemap.xml not generated: set `site.baseUrl` in your config to enable it."
5839
+ "sitemap.xml and feed.xml not generated: set `site.baseUrl` in your config to enable them."
2064
5840
  );
2065
5841
  }
2066
5842
  if (site.search.enabled) {
@@ -2089,7 +5865,7 @@ async function renderOne(input2) {
2089
5865
  const pageMetaCfg = input2.site.pageMeta;
2090
5866
  const readingMin = pageMetaCfg.readingTime ? readingMinutes(countWords(parsed.content)) : void 0;
2091
5867
  const lastModified = pageMetaCfg.lastModified ? await lastModifiedISO({ absPath: input2.absInput, cwd: input2.cwd }) : void 0;
2092
- const html = renderPage({
5868
+ const html2 = renderPage({
2093
5869
  site: input2.site,
2094
5870
  nav: input2.nav,
2095
5871
  url: input2.url,
@@ -2107,7 +5883,13 @@ async function renderOne(input2) {
2107
5883
  lastModified,
2108
5884
  bodyClass: input2.url === "/404/" ? "ov-body-404" : void 0
2109
5885
  });
2110
- return { html, title, warnings: [] };
5886
+ return {
5887
+ html: html2,
5888
+ title,
5889
+ description: frontmatter.description,
5890
+ lastModified,
5891
+ warnings: []
5892
+ };
2111
5893
  }
2112
5894
  async function readLandingBody(inputAbs, site) {
2113
5895
  const abs = import_path5.default.join(inputAbs, LANDING_BODY_FILE);
@@ -2115,13 +5897,30 @@ async function readLandingBody(inputAbs, site) {
2115
5897
  const raw = await (0, import_promises3.readFile)(abs, "utf8");
2116
5898
  const { content } = (0, import_gray_matter2.default)(raw);
2117
5899
  if (!content.trim()) return void 0;
2118
- const { html } = await renderMarkdown(content, { codeTheme: site.codeTheme });
2119
- return { html, sourcePath: import_path5.default.join(import_path5.default.basename(inputAbs), LANDING_BODY_FILE) };
5900
+ const { html: html2 } = await renderMarkdown(content, { codeTheme: site.codeTheme });
5901
+ return { html: html2, sourcePath: import_path5.default.join(import_path5.default.basename(inputAbs), LANDING_BODY_FILE) };
2120
5902
  }
2121
5903
  function firstNavUrl(nav) {
2122
5904
  const first = nav.children.find((c) => c.sourcePath !== void 0);
2123
5905
  return first?.url;
2124
5906
  }
5907
+ function sidebarRootFor(nav) {
5908
+ const groups = nav.children.filter((c) => c.children.length > 0);
5909
+ const looseRootPages = nav.children.filter(
5910
+ (c) => c.sourcePath !== void 0 && c.children.length === 0 && c.url !== "/404/"
5911
+ );
5912
+ if (groups.length !== 1 || looseRootPages.length > 0) return nav;
5913
+ const section = groups[0];
5914
+ const lead = section.sourcePath ? [
5915
+ {
5916
+ title: section.title,
5917
+ url: section.url,
5918
+ sourcePath: section.sourcePath,
5919
+ children: []
5920
+ }
5921
+ ] : [];
5922
+ return { ...section, children: [...lead, ...section.children] };
5923
+ }
2125
5924
  function resolveSiteConfig(config) {
2126
5925
  const title = config.site.title ?? config.name ?? "Ovellum site";
2127
5926
  return { ...config.site, title };
@@ -2179,11 +5978,11 @@ function resolveTemplateDir() {
2179
5978
  function extractMarkdownLinks(content) {
2180
5979
  const tree = (0, import_unified2.unified)().use(import_remark_parse2.default).parse(content);
2181
5980
  const out = [];
2182
- (0, import_unist_util_visit2.visit)(tree, "link", (node) => {
2183
- if (typeof node.url !== "string") return;
5981
+ (0, import_unist_util_visit3.visit)(tree, "link", (node2) => {
5982
+ if (typeof node2.url !== "string") return;
2184
5983
  out.push({
2185
- target: node.url,
2186
- line: node.position?.start.line ?? 1
5984
+ target: node2.url,
5985
+ line: node2.position?.start.line ?? 1
2187
5986
  });
2188
5987
  });
2189
5988
  return out;
@@ -2213,6 +6012,7 @@ async function runBuild(input2) {
2213
6012
  let finalBody = generatedBody;
2214
6013
  if (config.mode === "hybrid" && (0, import_node_fs.existsSync)(abs)) {
2215
6014
  const manualDoc = await readManualDoc(abs);
6015
+ warnings.push(...manualDoc.warnings);
2216
6016
  if (manualDoc.protectedBlocks.length > 0) {
2217
6017
  const result = merge(generatedBody, manualDoc, { sourceFile: relOut });
2218
6018
  finalBody = result.content;
@@ -2716,10 +6516,10 @@ async function serve404(opts, res) {
2716
6516
  res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
2717
6517
  res.end("Not Found");
2718
6518
  }
2719
- function injectReloadScript(html) {
6519
+ function injectReloadScript(html2) {
2720
6520
  const tag = `<script src="${RELOAD_SCRIPT_PATH}" defer></script>`;
2721
- if (/<\/body>/i.test(html)) return html.replace(/<\/body>/i, `${tag}$&`);
2722
- return html + tag;
6521
+ if (/<\/body>/i.test(html2)) return html2.replace(/<\/body>/i, `${tag}$&`);
6522
+ return html2 + tag;
2723
6523
  }
2724
6524
  async function findFreePort(host, start, range) {
2725
6525
  for (let p = start; p < start + range; p++) {
@@ -3131,11 +6931,11 @@ ${a.description || `Welcome to **${a.title}**. This file is \`${a.input}/index.m
3131
6931
  async function ensureGitignore(cwd, a) {
3132
6932
  const gi = import_node_path7.default.join(cwd, ".gitignore");
3133
6933
  const want = a.mode === "auto" ? [a.output, ".orphans/"] : [a.output, ".orphans/"];
3134
- const wantNorm = want.map((p) => stripTrailingSlash2(p));
6934
+ const wantNorm = want.map((p) => stripTrailingSlash3(p));
3135
6935
  let current = "";
3136
6936
  if ((0, import_node_fs4.existsSync)(gi)) current = await (0, import_promises9.readFile)(gi, "utf8");
3137
6937
  const have = new Set(
3138
- current.split(/\r?\n/).map((l) => stripTrailingSlash2(l.trim())).filter(Boolean)
6938
+ current.split(/\r?\n/).map((l) => stripTrailingSlash3(l.trim())).filter(Boolean)
3139
6939
  );
3140
6940
  const missing = wantNorm.filter((p) => !have.has(p));
3141
6941
  if (missing.length === 0) return false;
@@ -3164,7 +6964,7 @@ function nextSteps(a) {
3164
6964
  function titleFromName(name) {
3165
6965
  return name.split(/[-_./@\s]/).filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
3166
6966
  }
3167
- function stripTrailingSlash2(s) {
6967
+ function stripTrailingSlash3(s) {
3168
6968
  return s.endsWith("/") ? s.slice(0, -1) : s;
3169
6969
  }
3170
6970