import transformRoute from "../utils/transformRoute.mjs";
function fromEntries(iterable) {
  return [...iterable].reduce(
    (obj, [key, val]) => {
      obj[key] = val;
      return obj;
    },
    {}
  );
}
function getMenuData(routes, menu, formatMessage, menuDataRender) {
  const { menuData, breadcrumb } = transformRoute(
    routes,
    (menu == null ? void 0 : menu.locale) || false,
    formatMessage,
    true
  );
  if (!menuDataRender) {
    return {
      breadcrumb: fromEntries(breadcrumb),
      breadcrumbMap: breadcrumb,
      menuData
    };
  }
  return getMenuData(menuDataRender(menuData), menu, formatMessage, void 0);
}
export {
  getMenuData
};
