import CJS_COMPAT_NODE_URL_tlvz2cb53gb from 'node:url';
import CJS_COMPAT_NODE_PATH_tlvz2cb53gb from 'node:path';
import CJS_COMPAT_NODE_MODULE_tlvz2cb53gb from "node:module";

var __filename = CJS_COMPAT_NODE_URL_tlvz2cb53gb.fileURLToPath(import.meta.url);
var __dirname = CJS_COMPAT_NODE_PATH_tlvz2cb53gb.dirname(__filename);
var require = CJS_COMPAT_NODE_MODULE_tlvz2cb53gb.createRequire(import.meta.url);

// ------------------------------------------------------------
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
// ------------------------------------------------------------

// src/preset.ts
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import yaml from "yaml";
var experimental_indexers = (existingIndexers) => [
  {
    test: /(stories|story)\.(json|ya?ml)$/,
    createIndex: async (fileName) => {
      let rawFile = await readFile(fileName, { encoding: "utf8" }), content = fileName.endsWith(".json") ? JSON.parse(rawFile) : yaml.parse(rawFile);
      return content.stories.map((story) => {
        let tags = Array.from(/* @__PURE__ */ new Set([...content.tags ?? [], ...story.tags ?? []]));
        return {
          importPath: fileName,
          exportName: story.name,
          name: story.name,
          title: content.title,
          tags,
          type: "story"
        };
      });
    }
  },
  ...existingIndexers || []
], previewAnnotations = async (input = [], options) => {
  let { presetsList } = options;
  return presetsList ? [].concat(input).concat([fileURLToPath(import.meta.resolve("@storybook/server/entry-preview"))]) : input;
};
export {
  experimental_indexers,
  previewAnnotations
};
