@fern-api/fdr-sdk 1.2.42-5d054efb73 → 1.2.42-6d01f91096

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/js/converters/index.js +0 -9
  2. package/dist/js/converters/index.js.map +1 -1
  3. package/dist/js/converters/index.mjs +0 -9
  4. package/dist/js/converters/index.mjs.map +1 -1
  5. package/dist/js/index.js +0 -9
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +0 -9
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/navigation/index.js +0 -9
  10. package/dist/js/navigation/index.js.map +1 -1
  11. package/dist/js/navigation/index.mjs +0 -9
  12. package/dist/js/navigation/index.mjs.map +1 -1
  13. package/dist/js/navigation/ledger-root-builder.js +36 -191
  14. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  15. package/dist/js/navigation/ledger-root-builder.mjs +36 -191
  16. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  17. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +4 -109
  18. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
  19. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +0 -102
  20. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
  21. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js +0 -276
  22. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js.map +1 -1
  23. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  24. package/dist/navigation/ledger-root-builder.js +47 -275
  25. package/dist/navigation/ledger-root-builder.js.map +1 -1
  26. package/dist/navigation/utils/index.d.ts +0 -1
  27. package/dist/navigation/utils/index.d.ts.map +1 -1
  28. package/dist/navigation/utils/index.js +0 -1
  29. package/dist/navigation/utils/index.js.map +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  32. package/dist/types/navigation/utils/index.d.ts +0 -1
  33. package/dist/types/navigation/utils/index.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  36. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  37. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +0 -267
  38. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +0 -1
  39. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  40. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  41. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +0 -306
  42. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +0 -1
  43. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  44. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  45. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +0 -273
  46. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +0 -1
  47. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  48. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  49. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +0 -256
  50. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +0 -1
  51. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  52. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  53. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js +0 -29
  54. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js.map +0 -1
  55. package/dist/navigation/utils/syntheticSectionPath.d.ts +0 -13
  56. package/dist/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
  57. package/dist/navigation/utils/syntheticSectionPath.js +0 -20
  58. package/dist/navigation/utils/syntheticSectionPath.js.map +0 -1
  59. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  60. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  61. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  62. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  63. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  64. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  65. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  66. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  67. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  68. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  69. package/dist/types/navigation/utils/syntheticSectionPath.d.ts +0 -13
  70. package/dist/types/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
@@ -92,17 +92,6 @@ var VersionIdSchema = z.string();
92
92
  function VersionId(value) {
93
93
  return value;
94
94
  }
95
- var Availability = {
96
- Alpha: "Alpha",
97
- Stable: "Stable",
98
- GenerallyAvailable: "GenerallyAvailable",
99
- InDevelopment: "InDevelopment",
100
- PreRelease: "PreRelease",
101
- Deprecated: "Deprecated",
102
- Beta: "Beta",
103
- Preview: "Preview",
104
- Legacy: "Legacy"
105
- };
106
95
  var SnippetsByEndpointMethodSchema = z.record(
107
96
  HttpMethodSchema,
108
97
  z.array(z.unknown())
@@ -856,12 +845,6 @@ function traverseDF(node, visit) {
856
845
  return dfs(node, visit, getChildren);
857
846
  }
858
847
 
859
- // src/navigation/utils/syntheticSectionPath.ts
860
- var SYNTHETIC_SEGMENT_RE = /^~\d+$/;
861
- function stripSyntheticSegments(section) {
862
- return section.split("/").filter((part) => !SYNTHETIC_SEGMENT_RE.test(part)).join("/");
863
- }
864
-
865
848
  // src/navigation/ledger-root-builder.ts
866
849
  var STRUCTURAL_SEGMENT_TYPES = /* @__PURE__ */ new Set([
867
850
  "section",
@@ -899,35 +882,6 @@ function metaStr(metadata, key) {
899
882
  }
900
883
  return void 0;
901
884
  }
902
- var AVAILABILITY_LOOKUP = {
903
- // V1 lowercase values (stored by docsPublishTransform from V1 navigation tree)
904
- alpha: Availability.Alpha,
905
- stable: Availability.Stable,
906
- "generally-available": Availability.GenerallyAvailable,
907
- "in-development": Availability.InDevelopment,
908
- "pre-release": Availability.PreRelease,
909
- deprecated: Availability.Deprecated,
910
- beta: Availability.Beta,
911
- preview: Availability.Preview,
912
- legacy: Availability.Legacy,
913
- // Latest PascalCase values (pass-through)
914
- Alpha: Availability.Alpha,
915
- Stable: Availability.Stable,
916
- GenerallyAvailable: Availability.GenerallyAvailable,
917
- InDevelopment: Availability.InDevelopment,
918
- PreRelease: Availability.PreRelease,
919
- Deprecated: Availability.Deprecated,
920
- Beta: Availability.Beta,
921
- Preview: Availability.Preview,
922
- Legacy: Availability.Legacy
923
- };
924
- function metaAvailability(metadata) {
925
- const raw = metaStr(metadata, "availability");
926
- if (raw == null) {
927
- return void 0;
928
- }
929
- return AVAILABILITY_LOOKUP[raw];
930
- }
931
885
  function metaBool(metadata, key) {
932
886
  if (metadata != null && typeof metadata === "object" && key in metadata) {
933
887
  const v = metadata[key];
@@ -1045,7 +999,7 @@ function artifactToNode(ctx, route) {
1045
999
  }),
1046
1000
  pageId: PageId(pageId),
1047
1001
  noindex: metaBool(md, "noindex"),
1048
- availability: metaAvailability(md)
1002
+ availability: metaStr(md, "availability")
1049
1003
  };
1050
1004
  return node;
1051
1005
  }
@@ -1110,7 +1064,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1110
1064
  endpointId: EndpointId(endpointId),
1111
1065
  apiDefinitionId,
1112
1066
  isResponseStream: metaBool(md, "isResponseStream"),
1113
- availability: metaAvailability(md),
1067
+ availability: metaStr(md, "availability"),
1114
1068
  playground: void 0
1115
1069
  };
1116
1070
  }
@@ -1126,7 +1080,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1126
1080
  method,
1127
1081
  webhookId: WebhookId(webhookId),
1128
1082
  apiDefinitionId,
1129
- availability: metaAvailability(md)
1083
+ availability: metaStr(md, "availability")
1130
1084
  };
1131
1085
  }
1132
1086
  if (route.type === "asyncapi") {
@@ -1139,7 +1093,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1139
1093
  ...meta,
1140
1094
  webSocketId: WebSocketId(webSocketId),
1141
1095
  apiDefinitionId,
1142
- availability: metaAvailability(md),
1096
+ availability: metaStr(md, "availability"),
1143
1097
  playground: void 0
1144
1098
  };
1145
1099
  }
@@ -1155,7 +1109,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1155
1109
  method,
1156
1110
  grpcId: GrpcId(grpcId),
1157
1111
  apiDefinitionId,
1158
- availability: metaAvailability(md)
1112
+ availability: metaStr(md, "availability")
1159
1113
  };
1160
1114
  }
1161
1115
  if (route.type === "graphql") {
@@ -1171,7 +1125,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1171
1125
  graphqlOperationId: GraphQlOperationId(graphqlOperationId),
1172
1126
  graphqlOperationIds: void 0,
1173
1127
  apiDefinitionId,
1174
- availability: metaAvailability(md),
1128
+ availability: metaStr(md, "availability"),
1175
1129
  playground: void 0
1176
1130
  };
1177
1131
  }
@@ -1284,8 +1238,7 @@ function structuralNodeSlug(ctx, overviewFullPath, section, scopePrefix) {
1284
1238
  if (overviewFullPath != null) {
1285
1239
  return ctx.contentSlug(overviewFullPath);
1286
1240
  }
1287
- const cleanSection = stripSyntheticSegments(section);
1288
- return cleanSection !== "" ? slugjoin(scopePrefix, cleanSection) : scopePrefix;
1241
+ return section !== "" ? slugjoin(scopePrefix, section) : scopePrefix;
1289
1242
  }
1290
1243
  function stripLeadingScopePrefix(section, scopePrefix) {
1291
1244
  const prefix = scopePrefix;
@@ -1300,30 +1253,6 @@ function stripLeadingScopePrefix(section, scopePrefix) {
1300
1253
  }
1301
1254
  return section;
1302
1255
  }
1303
- function computeDuplicateSiblingSortBoundaries(siblings) {
1304
- const result = /* @__PURE__ */ new Map();
1305
- const byPath = /* @__PURE__ */ new Map();
1306
- for (const sibling of siblings) {
1307
- if (metaStr(sibling.seg.metadata, "type") !== "section") {
1308
- continue;
1309
- }
1310
- const group = byPath.get(sibling.seg.section) ?? [];
1311
- group.push(sibling);
1312
- byPath.set(sibling.seg.section, group);
1313
- }
1314
- for (const [, group] of byPath) {
1315
- if (group.length <= 1) {
1316
- continue;
1317
- }
1318
- for (let i = 0; i < group.length; i++) {
1319
- result.set(group[i], {
1320
- lo: group[i].seg.sortOrder,
1321
- hi: i + 1 < group.length ? group[i + 1].seg.sortOrder : Number.MAX_SAFE_INTEGER
1322
- });
1323
- }
1324
- }
1325
- return result;
1326
- }
1327
1256
  function mergeChildrenByPosition(ctx, nav, sectionChildren) {
1328
1257
  const leafNodes = [];
1329
1258
  for (let i = 0; i < nav.length; i++) {
@@ -1373,20 +1302,17 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
1373
1302
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1374
1303
  collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1375
1304
  collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1376
- availability: metaAvailability(seg.metadata),
1305
+ availability: metaStr(seg.metadata, "availability"),
1377
1306
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
1378
1307
  children: mergeChildrenByPosition(ctx, nav, sectionChildren)
1379
1308
  };
1380
1309
  }
1381
- function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
1310
+ function directChildApiPackages(parentSection, scopeSegs) {
1382
1311
  const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1383
1312
  return scopeSegs.filter((s) => {
1384
1313
  if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
1385
1314
  return false;
1386
1315
  }
1387
- if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
1388
- return false;
1389
- }
1390
1316
  const parent = parentSectionPath(s.seg.section);
1391
1317
  if (parent === parentSection) {
1392
1318
  return true;
@@ -1400,7 +1326,7 @@ function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
1400
1326
  function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
1401
1327
  const { seg, nav } = scoped;
1402
1328
  const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
1403
- const childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
1329
+ const childPackages = directChildApiPackages(seg.section, scopeSegs);
1404
1330
  const packageNodes = childPackages.map((child) => ({
1405
1331
  node: apiPackageChildNode(
1406
1332
  ctx,
@@ -1450,7 +1376,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
1450
1376
  featureFlags: metaFeatureFlags(seg.metadata)
1451
1377
  }),
1452
1378
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1453
- availability: metaAvailability(seg.metadata),
1379
+ availability: metaStr(seg.metadata, "availability"),
1454
1380
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1455
1381
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1456
1382
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1538,10 +1464,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
1538
1464
  featureFlags: metaFeatureFlags(seg.metadata)
1539
1465
  }),
1540
1466
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1541
- availability: metaAvailability(seg.metadata),
1467
+ availability: metaStr(seg.metadata, "availability"),
1542
1468
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1543
1469
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1544
- paginated: metaBool(seg.metadata, "paginated"),
1470
+ paginated: true,
1545
1471
  showErrors: metaBool(seg.metadata, "showErrors"),
1546
1472
  hideTitle: metaBool(seg.metadata, "hideTitle"),
1547
1473
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1559,10 +1485,7 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
1559
1485
  }
1560
1486
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1561
1487
  });
1562
- const apiReferenceCount = scopeSegs.filter((candidate) => {
1563
- return metaStr(candidate.seg.metadata, "type") === "apiReference" && metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1564
- }).length;
1565
- const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? (apiReferenceCount === 1 ? candidates[0] : void 0);
1488
+ const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? candidates[0];
1566
1489
  return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
1567
1490
  }
1568
1491
  function hasOwningApiReference(scoped, scopeSegs) {
@@ -1570,51 +1493,12 @@ function hasOwningApiReference(scoped, scopeSegs) {
1570
1493
  if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
1571
1494
  return false;
1572
1495
  }
1573
- const candidates = scopeSegs.filter((candidate) => {
1496
+ return scopeSegs.some((candidate) => {
1574
1497
  if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
1575
1498
  return false;
1576
1499
  }
1577
1500
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1578
1501
  });
1579
- return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
1580
- }
1581
- function isNestedApiPackage(scoped, scopeSegs) {
1582
- if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
1583
- return false;
1584
- }
1585
- const apiDefinitionId = metaStr(scoped.seg.metadata, "apiDefinitionId");
1586
- if (apiDefinitionId == null) {
1587
- return false;
1588
- }
1589
- const apiReferenceSections = new Set(
1590
- scopeSegs.filter(
1591
- (s) => metaStr(s.seg.metadata, "type") === "apiReference" && metaStr(s.seg.metadata, "apiDefinitionId") === apiDefinitionId
1592
- ).map((s) => s.seg.section)
1593
- );
1594
- if (apiReferenceSections.size === 0) {
1595
- return false;
1596
- }
1597
- const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1598
- const resolveParent = (section) => {
1599
- const parent = parentSectionPath(section);
1600
- if (parent === "" || sectionPaths.has(parent)) {
1601
- return parent;
1602
- }
1603
- return nearestExistingAncestor(section, sectionPaths);
1604
- };
1605
- let current = scoped.seg.section;
1606
- const seen = /* @__PURE__ */ new Set([current]);
1607
- for (; ; ) {
1608
- const parent = resolveParent(current);
1609
- if (apiReferenceSections.has(parent)) {
1610
- return true;
1611
- }
1612
- if (parent === "" || seen.has(parent)) {
1613
- return false;
1614
- }
1615
- seen.add(parent);
1616
- current = parent;
1617
- }
1618
1502
  }
1619
1503
  function changelogNode(ctx, scoped, scopePrefix) {
1620
1504
  const { seg, nav } = scoped;
@@ -1719,11 +1603,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1719
1603
  if (sec === "" || type === "tabRoot") {
1720
1604
  return false;
1721
1605
  }
1722
- if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1723
- return false;
1724
- }
1725
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1726
- if (depth === 0) {
1606
+ if (hasOwningApiReference(s, scopeSegs)) {
1727
1607
  return false;
1728
1608
  }
1729
1609
  const parent = parentSectionPath(sec);
@@ -1735,7 +1615,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1735
1615
  }
1736
1616
  return false;
1737
1617
  }).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1738
- const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
1739
1618
  return direct.map((s) => {
1740
1619
  const type = metaStr(s.seg.metadata, "type");
1741
1620
  const childIndex = metaNum(s.seg.metadata, "childIndex");
@@ -1745,14 +1624,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1745
1624
  } else if (type === "changelog") {
1746
1625
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
1747
1626
  } else {
1748
- const boundary = siblingBoundaries.get(s);
1749
- const childScopeSegs = boundary != null ? scopeSegs.filter(
1750
- (candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
1751
- ) : scopeSegs;
1752
1627
  node = sectionNode(
1753
1628
  ctx,
1754
1629
  s,
1755
- buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1630
+ buildSectionTree(ctx, scopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1756
1631
  scopePrefix
1757
1632
  );
1758
1633
  }
@@ -1766,16 +1641,11 @@ function computeSiblingSortBoundaries(ordered) {
1766
1641
  for (const s of ordered) {
1767
1642
  const type = metaStr(s.seg.metadata, "type");
1768
1643
  const sec = s.seg.section;
1769
- if (type !== "section") {
1644
+ if (type !== "section" || sec === "") {
1770
1645
  continue;
1771
1646
  }
1772
- if (sec === "") {
1773
- rootSections.push(s);
1774
- continue;
1775
- }
1776
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1777
1647
  const parent = parentSectionPath(sec);
1778
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1648
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1779
1649
  if (isRootLevel) {
1780
1650
  rootSections.push(s);
1781
1651
  }
@@ -1802,14 +1672,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1802
1672
  const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1803
1673
  const sectionPaths = new Set(ordered.map((s) => s.seg.section));
1804
1674
  const annotated = [];
1675
+ const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
1805
1676
  const siblingBoundaries = computeSiblingSortBoundaries(ordered);
1806
- const hasRootSection = ordered.some(
1807
- (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
1808
- );
1809
1677
  for (const s of ordered) {
1810
1678
  const type = metaStr(s.seg.metadata, "type");
1811
1679
  const sec = s.seg.section;
1812
- if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1680
+ if (hasOwningApiReference(s, scopeSegs)) {
1813
1681
  continue;
1814
1682
  }
1815
1683
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
@@ -1824,18 +1692,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1824
1692
  }
1825
1693
  continue;
1826
1694
  }
1827
- if (type === "section" && sec === "" && hasRootSection) {
1828
- const bounds = siblingBoundaries.get(s);
1829
- const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1830
- const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
1695
+ if (type === "section" && sec === "") {
1696
+ const sectionChildren = buildSectionTree(ctx, scopeSegs, "", scopePrefix);
1831
1697
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1832
1698
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
1833
1699
  continue;
1834
1700
  }
1835
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1836
1701
  const parent = parentSectionPath(sec);
1837
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1838
- if (isRootLevel && hasRootSection && sec !== "" && depth == null) {
1702
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1703
+ if (isRootLevel && hasRootSection && sec !== "") {
1839
1704
  continue;
1840
1705
  }
1841
1706
  if (isRootLevel) {
@@ -1847,9 +1712,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1847
1712
  } else {
1848
1713
  const bounds = siblingBoundaries.get(s);
1849
1714
  const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1850
- const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
1851
- const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
1852
- node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1715
+ node = sectionNode(
1716
+ ctx,
1717
+ s,
1718
+ buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
1719
+ scopePrefix
1720
+ );
1853
1721
  }
1854
1722
  const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
1855
1723
  annotated.push({
@@ -1887,6 +1755,10 @@ function groupSidebarRootChildren(ctx, children) {
1887
1755
  } else if (child.type === "section" && !child.collapsible) {
1888
1756
  flushRun();
1889
1757
  out.push(child);
1758
+ } else if (child.type === "changelog") {
1759
+ flushRun();
1760
+ run.push(child);
1761
+ flushRun();
1890
1762
  } else {
1891
1763
  run.push(child);
1892
1764
  }
@@ -2001,7 +1873,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
2001
1873
  const variantIndividualSlug = detailSlug(variant);
2002
1874
  const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
2003
1875
  const metaPointsTo = metaStr(variant.metadata, "pointsTo");
2004
- const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
1876
+ const children = buildSidebarRootChildren(ctx, variantSegs, scopePrefix);
2005
1877
  return {
2006
1878
  type: "variant",
2007
1879
  ...withMetadataDefaults({
@@ -2403,7 +2275,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2403
2275
  };
2404
2276
  return node;
2405
2277
  });
2406
- markCrossProductCanonicalSlugs(children);
2407
2278
  return {
2408
2279
  type: "productgroup",
2409
2280
  id: ctx.nodeId("productgroup"),
@@ -2415,32 +2286,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2415
2286
  children
2416
2287
  };
2417
2288
  }
2418
- function markCrossProductCanonicalSlugs(productNodes) {
2419
- const pageIdToCanonical = /* @__PURE__ */ new Map();
2420
- const sorted = [...productNodes].sort((a, b) => {
2421
- if (a.default !== b.default) {
2422
- return a.default ? -1 : 1;
2423
- }
2424
- return 0;
2425
- });
2426
- for (const product of sorted) {
2427
- traverseDF(product, (child) => {
2428
- if (hasMetadata(child) && isPage(child)) {
2429
- const pid = getPageId(child);
2430
- if (pid == null) {
2431
- return;
2432
- }
2433
- const key = `pid:${pid}`;
2434
- const canonical = pageIdToCanonical.get(key);
2435
- if (canonical != null && !product.default) {
2436
- child.canonicalSlug = canonical;
2437
- } else if (canonical == null) {
2438
- pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
2439
- }
2440
- }
2441
- });
2442
- }
2443
- }
2444
2289
  // Annotate the CommonJS export names for ESM import in node:
2445
2290
  0 && (module.exports = {
2446
2291
  apiLeafNodeFromNavRoute,