// packages/block-library/src/navigation/use-navigation-entities.js
import { useEntityRecords } from "@wordpress/core-data";
function useNavigationEntities(menuId) {
  const {
    records: menus,
    isResolving: isResolvingMenus,
    hasResolved: hasResolvedMenus
  } = useEntityRecords("root", "menu", { per_page: -1, context: "view" });
  const {
    records: pages,
    isResolving: isResolvingPages,
    hasResolved: hasResolvedPages
  } = useEntityRecords("postType", "page", {
    parent: 0,
    order: "asc",
    orderby: "id",
    per_page: -1,
    context: "view"
  });
  const { records: menuItems, hasResolved: hasResolvedMenuItems } = useEntityRecords(
    "root",
    "menuItem",
    {
      menus: menuId,
      per_page: -1,
      context: "view"
    },
    { enabled: !!menuId }
  );
  return {
    pages,
    isResolvingPages,
    hasResolvedPages,
    hasPages: !!(hasResolvedPages && pages?.length),
    menus,
    isResolvingMenus,
    hasResolvedMenus,
    hasMenus: !!(hasResolvedMenus && menus?.length),
    menuItems,
    hasResolvedMenuItems
  };
}
export {
  useNavigationEntities as default
};
//# sourceMappingURL=use-navigation-entities.js.map
