import CJS_COMPAT_NODE_URL from 'node:url';
import CJS_COMPAT_NODE_PATH from 'node:path';
import CJS_COMPAT_NODE_MODULE from "node:module";

const __filename = CJS_COMPAT_NODE_URL.fileURLToPath(import.meta.url);
const __dirname = CJS_COMPAT_NODE_PATH.dirname(__filename);
const require = CJS_COMPAT_NODE_MODULE.createRequire(import.meta.url);
// ------------------------------------------------------------
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
// ------------------------------------------------------------
var a = Object.defineProperty;
var e = (t, o) => a(t, "name", { value: o, configurable: !0 });

// src/bin/loader.ts
import { readFile as m } from "fs/promises";
import { fileURLToPath as n } from "url";
import { transform as p } from "esbuild";

// src/shared/constants/environments-support.ts
var r = "node20";

// src/bin/loader.ts
var T = /* @__PURE__ */ e(async (t, o, s) => {
  if (t.endsWith(".ts") || t.endsWith(".tsx") || t.endsWith(".mts") || t.endsWith(".cts") || t.endsWith(".mtsx") || t.endsWith(".ctsx")) {
    let i = await m(n(t), "utf-8");
    return {
      format: "module",
      shortCircuit: !0,
      source: (await p(i, {
        loader: "ts",
        target: r,
        format: "esm",
        platform: "neutral"
      })).code
    };
  }
  return s(t, o);
}, "load");
export {
  T as load
};
