import { y as defineEventHandler, af as handleCache, a as APUser, I as Instance } 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 trusted_get = defineEventHandler(async (evt) => {
  if (await handleCache(evt, APUser)) return;
  const trusted = await APUser.findAll({ where: { trusted: true }, include: [{ model: Instance, required: true }] });
  return trusted.map((t) => ({
    ap_id: t.ap_id,
    following: t.following,
    trusted: t.trusted,
    follower: t.follower,
    url: t.object.url,
    icon: t.object?.icon?.url,
    name: t.object.name,
    preferredUsername: t.object.preferredUsername,
    summary: t.object.summary,
    domain: t.instance?.domain,
    software: {
      name: t.instance?.data?.software?.name ?? "",
      version: t.instance?.data?.software?.version ?? ""
    }
  }));
});

export { trusted_get as default };
