import { ApiResponse } from "../request-response";
async function elementTreeHandler(req, { runtime }) {
  const body = await req.json();
  const { elementTree, replacementContext } = body;
  if (elementTree == null) {
    return ApiResponse.json({ message: "elementTree must be defined" }, { status: 400 });
  }
  if (replacementContext == null) {
    return ApiResponse.json({ message: "replacementContext must be defined" }, { status: 400 });
  }
  const generatedElementTree = runtime.copyElementTree(elementTree, replacementContext);
  return ApiResponse.json({ elementTree: generatedElementTree });
}
export {
  elementTreeHandler
};
//# sourceMappingURL=element-tree.js.map