import { g as getCollectionProducts } from '../../../chunks/collection-manager_BVQmA0IS.mjs';
export { renderers } from '../../../renderers.mjs';

const GET = async ({ params, url }) => {
  try {
    const slug = params.slug;
    const page = parseInt(url.searchParams.get("page") || "1");
    const limit = parseInt(url.searchParams.get("limit") || "24");
    const result = await getCollectionProducts(slug, { page, limit });
    if (!result) {
      return new Response(JSON.stringify({ error: "Collection not found" }), { status: 404 });
    }
    return new Response(JSON.stringify(result), {
      headers: { "Content-Type": "application/json" }
    });
  } catch (e) {
    return new Response(JSON.stringify({ error: e.message }), { status: 500 });
  }
};

const _page = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
  __proto__: null,
  GET
}, Symbol.toStringTag, { value: 'Module' }));

const page = () => _page;

export { page };
