import { d as defineEventHandler } from '../../nitro/nitro.mjs';
import { readFile } from 'fs/promises';
import { join } from 'path';
import { parse } from 'yaml';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'stream';
import 'events';
import 'http';
import 'crypto';
import 'buffer';
import 'zlib';
import 'https';
import 'net';
import 'tls';
import 'url';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'vue-router';
import '@prisma/client';
import '@prisma/adapter-better-sqlite3';
import 'fs';
import 'child_process';
import 'node:child_process';
import 'node:url';

const index_get = defineEventHandler(async () => {
  var _a, _b, _c, _d, _e, _f;
  const defaultCatalog = {
    segments: {
      definition: { description: "Preparation and qualification phases", columns: [] },
      action: { description: "Implementation and validation phases", columns: [] },
      finish: { description: "Finalization and deployment phases", columns: [] }
    }
  };
  try {
    const catalogPath = join(process.cwd(), "templates", "catalog.yaml");
    const content = await readFile(catalogPath, "utf-8");
    const rawCatalog = parse(content);
    if (!rawCatalog.segments) {
      return defaultCatalog;
    }
    return {
      segments: {
        definition: {
          description: ((_a = rawCatalog.segments["definition"]) == null ? void 0 : _a.description) || "Preparation and qualification phases",
          columns: (((_b = rawCatalog.segments["definition"]) == null ? void 0 : _b.columns) || []).map((col) => ({
            slug: col.slug,
            name: col.name,
            description: col.description
          }))
        },
        action: {
          description: ((_c = rawCatalog.segments["action"]) == null ? void 0 : _c.description) || "Implementation and validation phases",
          columns: (((_d = rawCatalog.segments["action"]) == null ? void 0 : _d.columns) || []).map((col) => ({
            slug: col.slug,
            name: col.name,
            description: col.description
          }))
        },
        finish: {
          description: ((_e = rawCatalog.segments["finish"]) == null ? void 0 : _e.description) || "Finalization and deployment phases",
          columns: (((_f = rawCatalog.segments["finish"]) == null ? void 0 : _f.columns) || []).map((col) => ({
            slug: col.slug,
            name: col.name,
            description: col.description
          }))
        }
      }
    };
  } catch {
    return defaultCatalog;
  }
});

export { index_get as default };
//# sourceMappingURL=index.get.mjs.map
