@fern-api/fdr-sdk 1.2.42-54880bfeac → 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 (90) hide show
  1. package/dist/js/client/FdrClient.js +0 -1
  2. package/dist/js/client/FdrClient.js.map +1 -1
  3. package/dist/js/client/FdrClient.mjs +0 -1
  4. package/dist/js/client/FdrClient.mjs.map +1 -1
  5. package/dist/js/converters/index.js +0 -9
  6. package/dist/js/converters/index.js.map +1 -1
  7. package/dist/js/converters/index.mjs +0 -9
  8. package/dist/js/converters/index.mjs.map +1 -1
  9. package/dist/js/index.js +0 -10
  10. package/dist/js/index.js.map +1 -1
  11. package/dist/js/index.mjs +0 -10
  12. package/dist/js/index.mjs.map +1 -1
  13. package/dist/js/navigation/index.js +0 -9
  14. package/dist/js/navigation/index.js.map +1 -1
  15. package/dist/js/navigation/index.mjs +0 -9
  16. package/dist/js/navigation/index.mjs.map +1 -1
  17. package/dist/js/navigation/ledger-root-builder.js +36 -212
  18. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  19. package/dist/js/navigation/ledger-root-builder.mjs +36 -212
  20. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  21. package/dist/js/orpc-client.js +0 -1
  22. package/dist/js/orpc-client.js.map +1 -1
  23. package/dist/js/orpc-client.mjs +0 -1
  24. package/dist/js/orpc-client.mjs.map +1 -1
  25. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +4 -109
  26. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
  27. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +0 -102
  28. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
  29. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js +0 -276
  30. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js.map +1 -1
  31. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  32. package/dist/navigation/ledger-root-builder.js +47 -312
  33. package/dist/navigation/ledger-root-builder.js.map +1 -1
  34. package/dist/navigation/utils/index.d.ts +0 -1
  35. package/dist/navigation/utils/index.d.ts.map +1 -1
  36. package/dist/navigation/utils/index.js +0 -1
  37. package/dist/navigation/utils/index.js.map +1 -1
  38. package/dist/orpc-client/docs-ledger/contract.d.ts +0 -9
  39. package/dist/orpc-client/docs-ledger/contract.d.ts.map +1 -1
  40. package/dist/orpc-client/docs-ledger/contract.js +0 -1
  41. package/dist/orpc-client/docs-ledger/contract.js.map +1 -1
  42. package/dist/tsconfig.tsbuildinfo +1 -1
  43. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  44. package/dist/types/navigation/utils/index.d.ts +0 -1
  45. package/dist/types/navigation/utils/index.d.ts.map +1 -1
  46. package/dist/types/orpc-client/docs-ledger/contract.d.ts +0 -9
  47. package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
  48. package/package.json +1 -1
  49. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  50. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  51. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +0 -267
  52. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +0 -1
  53. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  54. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  55. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +0 -306
  56. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +0 -1
  57. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  58. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  59. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +0 -273
  60. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +0 -1
  61. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
  62. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
  63. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js +0 -234
  64. package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js.map +0 -1
  65. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  66. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  67. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +0 -360
  68. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +0 -1
  69. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  70. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  71. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js +0 -29
  72. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js.map +0 -1
  73. package/dist/navigation/utils/syntheticSectionPath.d.ts +0 -13
  74. package/dist/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
  75. package/dist/navigation/utils/syntheticSectionPath.js +0 -20
  76. package/dist/navigation/utils/syntheticSectionPath.js.map +0 -1
  77. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  78. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  79. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  80. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  81. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  82. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  83. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +0 -2
  84. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +0 -1
  85. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  86. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  87. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  88. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  89. package/dist/types/navigation/utils/syntheticSectionPath.d.ts +0 -13
  90. 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,17 +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
- let childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
1404
- const samePathApiSiblings = scopeSegs.filter(
1405
- (s) => s.seg.section === seg.section && s.seg.sortOrder !== seg.sortOrder && API_NODE_SEGMENT_TYPES.has(metaStr(s.seg.metadata, "type") ?? "")
1406
- );
1407
- const hasCollapsedGroups = samePathApiSiblings.length > 0;
1408
- if (hasCollapsedGroups && metaStr(seg.metadata, "type") !== "apiReference") {
1409
- const nextSibling = samePathApiSiblings.filter((s) => s.seg.sortOrder > seg.sortOrder).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder)[0];
1410
- const lo = seg.sortOrder;
1411
- const hi = nextSibling?.seg.sortOrder ?? Number.MAX_SAFE_INTEGER;
1412
- childPackages = childPackages.filter((c) => c.seg.sortOrder > lo && c.seg.sortOrder < hi);
1413
- }
1329
+ const childPackages = directChildApiPackages(seg.section, scopeSegs);
1414
1330
  const packageNodes = childPackages.map((child) => ({
1415
1331
  node: apiPackageChildNode(
1416
1332
  ctx,
@@ -1421,9 +1337,6 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
1421
1337
  ),
1422
1338
  childIndex: metaNum(child.seg.metadata, "childIndex")
1423
1339
  }));
1424
- if (hasCollapsedGroups && metaStr(seg.metadata, "type") === "apiReference") {
1425
- return [...leafNodes, ...packageNodes.map((p, i) => ({ node: p.node, pos: leafNodes.length + i }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
1426
- }
1427
1340
  const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
1428
1341
  if (!hasChildIndex) {
1429
1342
  return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
@@ -1463,7 +1376,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
1463
1376
  featureFlags: metaFeatureFlags(seg.metadata)
1464
1377
  }),
1465
1378
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1466
- availability: metaAvailability(seg.metadata),
1379
+ availability: metaStr(seg.metadata, "availability"),
1467
1380
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1468
1381
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1469
1382
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1551,10 +1464,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
1551
1464
  featureFlags: metaFeatureFlags(seg.metadata)
1552
1465
  }),
1553
1466
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1554
- availability: metaAvailability(seg.metadata),
1467
+ availability: metaStr(seg.metadata, "availability"),
1555
1468
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1556
1469
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1557
- paginated: metaBool(seg.metadata, "paginated"),
1470
+ paginated: true,
1558
1471
  showErrors: metaBool(seg.metadata, "showErrors"),
1559
1472
  hideTitle: metaBool(seg.metadata, "hideTitle"),
1560
1473
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1572,10 +1485,7 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
1572
1485
  }
1573
1486
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1574
1487
  });
1575
- const apiReferenceCount = scopeSegs.filter((candidate) => {
1576
- return metaStr(candidate.seg.metadata, "type") === "apiReference" && metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1577
- }).length;
1578
- 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];
1579
1489
  return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
1580
1490
  }
1581
1491
  function hasOwningApiReference(scoped, scopeSegs) {
@@ -1583,51 +1493,12 @@ function hasOwningApiReference(scoped, scopeSegs) {
1583
1493
  if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
1584
1494
  return false;
1585
1495
  }
1586
- const candidates = scopeSegs.filter((candidate) => {
1496
+ return scopeSegs.some((candidate) => {
1587
1497
  if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
1588
1498
  return false;
1589
1499
  }
1590
1500
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1591
1501
  });
1592
- return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
1593
- }
1594
- function isNestedApiPackage(scoped, scopeSegs) {
1595
- if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
1596
- return false;
1597
- }
1598
- const apiDefinitionId = metaStr(scoped.seg.metadata, "apiDefinitionId");
1599
- if (apiDefinitionId == null) {
1600
- return false;
1601
- }
1602
- const apiReferenceSections = new Set(
1603
- scopeSegs.filter(
1604
- (s) => metaStr(s.seg.metadata, "type") === "apiReference" && metaStr(s.seg.metadata, "apiDefinitionId") === apiDefinitionId
1605
- ).map((s) => s.seg.section)
1606
- );
1607
- if (apiReferenceSections.size === 0) {
1608
- return false;
1609
- }
1610
- const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1611
- const resolveParent = (section) => {
1612
- const parent = parentSectionPath(section);
1613
- if (parent === "" || sectionPaths.has(parent)) {
1614
- return parent;
1615
- }
1616
- return nearestExistingAncestor(section, sectionPaths);
1617
- };
1618
- let current = scoped.seg.section;
1619
- const seen = /* @__PURE__ */ new Set([current]);
1620
- for (; ; ) {
1621
- const parent = resolveParent(current);
1622
- if (apiReferenceSections.has(parent)) {
1623
- return true;
1624
- }
1625
- if (parent === "" || seen.has(parent)) {
1626
- return false;
1627
- }
1628
- seen.add(parent);
1629
- current = parent;
1630
- }
1631
1502
  }
1632
1503
  function changelogNode(ctx, scoped, scopePrefix) {
1633
1504
  const { seg, nav } = scoped;
@@ -1732,11 +1603,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1732
1603
  if (sec === "" || type === "tabRoot") {
1733
1604
  return false;
1734
1605
  }
1735
- if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1736
- return false;
1737
- }
1738
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1739
- if (depth === 0) {
1606
+ if (hasOwningApiReference(s, scopeSegs)) {
1740
1607
  return false;
1741
1608
  }
1742
1609
  const parent = parentSectionPath(sec);
@@ -1748,7 +1615,6 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1748
1615
  }
1749
1616
  return false;
1750
1617
  }).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1751
- const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
1752
1618
  return direct.map((s) => {
1753
1619
  const type = metaStr(s.seg.metadata, "type");
1754
1620
  const childIndex = metaNum(s.seg.metadata, "childIndex");
@@ -1758,14 +1624,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1758
1624
  } else if (type === "changelog") {
1759
1625
  node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
1760
1626
  } else {
1761
- const boundary = siblingBoundaries.get(s);
1762
- const childScopeSegs = boundary != null ? scopeSegs.filter(
1763
- (candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
1764
- ) : scopeSegs;
1765
1627
  node = sectionNode(
1766
1628
  ctx,
1767
1629
  s,
1768
- buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1630
+ buildSectionTree(ctx, scopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
1769
1631
  scopePrefix
1770
1632
  );
1771
1633
  }
@@ -1779,16 +1641,11 @@ function computeSiblingSortBoundaries(ordered) {
1779
1641
  for (const s of ordered) {
1780
1642
  const type = metaStr(s.seg.metadata, "type");
1781
1643
  const sec = s.seg.section;
1782
- if (type !== "section") {
1783
- continue;
1784
- }
1785
- if (sec === "") {
1786
- rootSections.push(s);
1644
+ if (type !== "section" || sec === "") {
1787
1645
  continue;
1788
1646
  }
1789
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1790
1647
  const parent = parentSectionPath(sec);
1791
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1648
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1792
1649
  if (isRootLevel) {
1793
1650
  rootSections.push(s);
1794
1651
  }
@@ -1815,24 +1672,14 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1815
1672
  const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1816
1673
  const sectionPaths = new Set(ordered.map((s) => s.seg.section));
1817
1674
  const annotated = [];
1675
+ const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
1818
1676
  const siblingBoundaries = computeSiblingSortBoundaries(ordered);
1819
- const hasRootSection = ordered.some(
1820
- (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
1821
- );
1822
1677
  for (const s of ordered) {
1823
1678
  const type = metaStr(s.seg.metadata, "type");
1824
1679
  const sec = s.seg.section;
1825
- if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1680
+ if (hasOwningApiReference(s, scopeSegs)) {
1826
1681
  continue;
1827
1682
  }
1828
- if (type === "apiPackage") {
1829
- const hasApiRefSibling = ordered.some(
1830
- (sib) => sib.seg.section === sec && metaStr(sib.seg.metadata, "type") === "apiReference"
1831
- );
1832
- if (hasApiRefSibling) {
1833
- continue;
1834
- }
1835
- }
1836
1683
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
1837
1684
  continue;
1838
1685
  }
@@ -1845,18 +1692,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1845
1692
  }
1846
1693
  continue;
1847
1694
  }
1848
- if (type === "section" && sec === "" && hasRootSection) {
1849
- const bounds = siblingBoundaries.get(s);
1850
- const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1851
- const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
1695
+ if (type === "section" && sec === "") {
1696
+ const sectionChildren = buildSectionTree(ctx, scopeSegs, "", scopePrefix);
1852
1697
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1853
1698
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
1854
1699
  continue;
1855
1700
  }
1856
- const depth = metaNum(s.seg.metadata, "sidebarDepth");
1857
1701
  const parent = parentSectionPath(sec);
1858
- const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1859
- if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
1702
+ const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1703
+ if (isRootLevel && hasRootSection && sec !== "") {
1860
1704
  continue;
1861
1705
  }
1862
1706
  if (isRootLevel) {
@@ -1868,9 +1712,12 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1868
1712
  } else {
1869
1713
  const bounds = siblingBoundaries.get(s);
1870
1714
  const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1871
- const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
1872
- const sectionChildren = isUnboundedSkipSlugSibling ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
1873
- node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1715
+ node = sectionNode(
1716
+ ctx,
1717
+ s,
1718
+ buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix),
1719
+ scopePrefix
1720
+ );
1874
1721
  }
1875
1722
  const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
1876
1723
  annotated.push({
@@ -1908,6 +1755,10 @@ function groupSidebarRootChildren(ctx, children) {
1908
1755
  } else if (child.type === "section" && !child.collapsible) {
1909
1756
  flushRun();
1910
1757
  out.push(child);
1758
+ } else if (child.type === "changelog") {
1759
+ flushRun();
1760
+ run.push(child);
1761
+ flushRun();
1911
1762
  } else {
1912
1763
  run.push(child);
1913
1764
  }
@@ -2022,7 +1873,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
2022
1873
  const variantIndividualSlug = detailSlug(variant);
2023
1874
  const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
2024
1875
  const metaPointsTo = metaStr(variant.metadata, "pointsTo");
2025
- const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
1876
+ const children = buildSidebarRootChildren(ctx, variantSegs, scopePrefix);
2026
1877
  return {
2027
1878
  type: "variant",
2028
1879
  ...withMetadataDefaults({
@@ -2424,7 +2275,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2424
2275
  };
2425
2276
  return node;
2426
2277
  });
2427
- markCrossProductCanonicalSlugs(children);
2428
2278
  return {
2429
2279
  type: "productgroup",
2430
2280
  id: ctx.nodeId("productgroup"),
@@ -2436,32 +2286,6 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2436
2286
  children
2437
2287
  };
2438
2288
  }
2439
- function markCrossProductCanonicalSlugs(productNodes) {
2440
- const pageIdToCanonical = /* @__PURE__ */ new Map();
2441
- const sorted = [...productNodes].sort((a, b) => {
2442
- if (a.default !== b.default) {
2443
- return a.default ? -1 : 1;
2444
- }
2445
- return 0;
2446
- });
2447
- for (const product of sorted) {
2448
- traverseDF(product, (child) => {
2449
- if (hasMetadata(child) && isPage(child)) {
2450
- const pid = getPageId(child);
2451
- if (pid == null) {
2452
- return;
2453
- }
2454
- const key = `pid:${pid}`;
2455
- const canonical = pageIdToCanonical.get(key);
2456
- if (canonical != null && !product.default) {
2457
- child.canonicalSlug = canonical;
2458
- } else if (canonical == null) {
2459
- pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
2460
- }
2461
- }
2462
- });
2463
- }
2464
- }
2465
2289
  // Annotate the CommonJS export names for ESM import in node:
2466
2290
  0 && (module.exports = {
2467
2291
  apiLeafNodeFromNavRoute,