import { d as defineEventHandler, u as useLogger, g as getRouterParam, c as createError, P as Place, ah as sendError, ai as PlaceToAP, t as setHeader } from '../../../nitro/nitro.mjs';
import 'luxon';
import '@sequelize/core';
import 'html-to-text';
import 'zod';
import 'crypto';
import 'node:fs';
import 'sharp';
import 'path';
import 'node:stream';
import 'jsdom';
import 'dompurify';
import 'mime-types';
import 'fs';
import 'fs/promises';
import 'linkify-html';
import '@peertube/http-signature';
import 'jsonld';
import 'lodash.intersection';
import 'email-templates';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'node:events';
import 'node:buffer';
import 'node:path';
import 'vue';
import 'vue-router';
import 'dotenv';
import 'url';
import 'bcryptjs';
import 'slugify';
import 'umzug';
import 'consola';
import '@sequelize/core/decorators-legacy';
import 'util';
import 'mitt';
import 'ical.js';
import 'node:url';
import 'fast-xml-parser';

const _id_ = defineEventHandler(async (event) => {
  const log = useLogger("");
  const id = getRouterParam(event, "id");
  log.debug("[FEDI] Get location");
  if (!id) {
    throw createError({ statusCode: 400, statusMessage: "Bad request." });
  }
  const place = await Place.findByPk(id);
  if (!place) {
    log.warn(`[FEDI] Place ${id} not found`);
    return sendError(event, createError({ statusCode: 404, statusMessage: "Not found." }));
  }
  const ret = PlaceToAP(place);
  setHeader(event, "Content-Type", "application/activity+json; charset=utf-8");
  return ret;
});

export { _id_ as default };
