"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }require('./chunk-DGUM43GV.js');

// src/routing/resolveRoute.ts
async function resolveRoute(params) {
  const { client, siteId, path, preview = false } = params;
  try {
    const pageResponse = await client.getPage({
      siteId,
      path,
      preview
    });
    if (pageResponse) {
      const { loadPage } = await Promise.resolve().then(() => _interopRequireWildcard(require("./loadPage-E3ZC6NHB.js")));
      const pageData = await loadPage({
        client,
        siteId,
        path,
        preview
      });
      return {
        type: "page",
        pageData
      };
    }
  } catch (error) {
    const is404 = error instanceof Error && (error.message.includes("404") || error.message.includes("Not Found") || error.message.includes("not found"));
    if (is404) {
      console.debug("[resolveRoute] Page not found", { path });
    } else {
      console.warn("[resolveRoute] Failed to fetch page", {
        path,
        error: error instanceof Error ? error.message : String(error)
      });
    }
  }
  return {
    type: "not-found"
  };
}
async function resolveRoutes(params) {
  const { client, siteId, paths, preview } = params;
  const resolutions = await Promise.all(
    paths.map(async (path) => {
      const resolution = await resolveRoute({
        client,
        siteId,
        path,
        preview
      });
      return { path, resolution };
    })
  );
  return resolutions;
}



exports.resolveRoute = resolveRoute; exports.resolveRoutes = resolveRoutes;
//# sourceMappingURL=routing.js.map