var m = Object.defineProperty;
var r = (s, c) => m(s, "name", { value: c, configurable: !0 });
import { createDefaultMapFromCDN as f, createVirtualTypeScriptEnvironment as g, createSystem as h } from "./node_modules/.pnpm/@typescript_vfs@1.6.1_typescript@5.8.2/node_modules/@typescript/vfs/dist/vfs.esm.js";
import { expose as d } from "./node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.js";
import * as n from "./node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/typescript.js";
import { t as p } from "./node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/typescript.js";
import { setupTypeAcquisition as y } from "@cxai/ata";
import { createWorker as S } from "./node_modules/.pnpm/@valtown_codemirror-ts@3.0.0-9_@codemirror_autocomplete@6.18.6_@codemirror_lint@6.8.5_@codemi_zyfniedpy4wyedcrakm4jzo4te/node_modules/@valtown/codemirror-ts/dist/worker/createWorker.js";
async function A() {
  const s = await f(
    { target: p.ScriptTarget.ES2022 },
    p.version,
    !1,
    n
  ), c = h(s), l = g(c, [], n, {
    lib: ["ES2022"]
  }), i = y({
    projectName: "CM ATA Project",
    typescript: n,
    logger: console,
    fetcher: /* @__PURE__ */ r((e, o) => {
      console.log("fetcher", e, o);
      const a = typeof e == "string" ? e : "url" in e ? e.url : e.toString(), t = new URL(a);
      switch (console.log("fetcher", t, e), t.protocol) {
        case "jsr:":
        case "npm:":
          t.host = "esm.sh", t.protocol = "https:", t.searchParams.set("target", t.searchParams.get("target") ?? "deno");
          break;
        case "deno:":
          t.host = "deno.land", t.protocol = "https:";
      }
      return fetch(t.toString(), o);
    }, "fetcher"),
    delegate: {
      receivedFile: /* @__PURE__ */ r((e, o) => {
        l.createFile(o, e);
      }, "receivedFile"),
      started: /* @__PURE__ */ r(() => {
        console.log("ATA start");
      }, "started"),
      progress: /* @__PURE__ */ r((e, o) => {
        console.log(`Got ${e} out of ${o}`);
      }, "progress"),
      finished: /* @__PURE__ */ r((e) => {
        console.log("ATA done", e);
      }, "finished")
    }
  });
  return {
    env: l,
    onFileUpdated(e, o, a) {
      i(a);
    }
  };
}
r(A, "createTSEnv");
const T = S(A());
d(T);
