import { d as defineEventHandler, w as publicSettings, a8 as publicSettingsLastModified, t as setHeader, h as handleCache } from '../nitro/nitro.mjs';
import fs from 'fs/promises';
import path from 'path';
import 'luxon';
import '@sequelize/core';
import 'html-to-text';
import 'zod';
import 'crypto';
import 'node:fs';
import 'sharp';
import 'node:stream';
import 'jsdom';
import 'dompurify';
import 'mime-types';
import 'fs';
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 custom_css = defineEventHandler(async (event) => {
  let custom_css = publicSettings.custom_css;
  let stat = null;
  let lastModified = publicSettingsLastModified.custom_css || /* @__PURE__ */ new Date(0);
  try {
    const filePath = path.resolve("./custom.css");
    stat = await fs.stat(filePath);
    custom_css += await fs.readFile(filePath, "utf8");
    if (stat.mtime > lastModified) {
      lastModified = stat.mtime;
    }
  } catch {
    custom_css += "\n/** no custom.css file **/";
  }
  setHeader(event, "Content-Type", "text/css");
  if (await handleCache(event, lastModified)) return;
  return custom_css;
});

export { custom_css as default };
