"use strict";var v=Object.defineProperty;var o=(e,t)=>v(e,"name",{value:t,configurable:!0});var u=require("node:module"),h=require("node:worker_threads"),w=require("./register-DfubRCxM.cjs"),_=require("node:url"),f=typeof document<"u"?document.currentScript:null;const b=o((e,t,r)=>{const a=t.startsWith("file://")?t:_.pathToFileURL(t),n=new URL(e,a);return n.searchParams.set("tsx-namespace",r),n.toString()},"resolveSpecifier"),S=o(e=>(t,r)=>{if(!r)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");return import(b(t,r,e))},"createScopedImport");let m=!1;const E=o(e=>{if(!u.register)throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`);if(!m){const{_resolveFilename:s}=u;u._resolveFilename=(p,d,l,g)=>s(w.interopCjsExports(p),d,l,g),m=!0}const{sourceMapsEnabled:t}=process;process.setSourceMapsEnabled(!0);const{port1:r,port2:a}=new h.MessageChannel;u.register(`./esm/index.mjs?${Date.now()}`,{parentURL:typeof document>"u"?require("url").pathToFileURL(__filename).href:f&&f.src||new URL("register-B9EPB0EL.cjs",document.baseURI).href,data:{port:a,namespace:e?.namespace,tsconfig:e?.tsconfig},transferList:[a]});const n=e?.onImport,i=n&&(s=>{s.type==="load"&&n(s.url)});i&&(r.on("message",i),r.unref());const c=o(()=>(t===!1&&process.setSourceMapsEnabled(!1),i&&r.off("message",i),r.postMessage("deactivate"),new Promise(s=>{const p=o(d=>{d.type==="deactivated"&&(s(),r.off("message",p))},"onDeactivated");r.on("message",p)})),"unregister");return e?.namespace&&(c.import=S(e.namespace),c.unregister=c),c},"register");exports.register=E;