const e=require(`../constants/vite.constants.cjs`),t=require(`./worker.registry.cjs`),n=require(`./WorkerWrapper.cjs`);var r=class r{static rnWorkerFactory=null;constructor(){}static resolveWorkerURL=async e=>{let{getWorkerViteURL:t}=await Promise.resolve().then(()=>require(`./viteWorkerURL.constant.cjs`));return(await t())[e]};static async createBrowserWorker(e){let t=await r.resolveWorkerURL(e);return new Worker(t,{type:`module`})}static async createNodeWorker(e){let{Worker:n}=require(`worker_threads`),r=require(`path`),{existsSync:i}=require(`fs`),a=r.join(__dirname,t.workerNodeURL[e]),o=a.replace(`.js`,`.cjs`);return new n(i(o)?o:a)}static async createWorker(t){return e.isNode?r.createNodeWorker(t):r.createBrowserWorker(t)}static async getWebWorker(e){return r.rnWorkerFactory?(console.log(`using rnWorkerFactory`),console.log(`WorkerFactory.rnWorkerFactory`,r.rnWorkerFactory),new n.WorkerWrapper(r.rnWorkerFactory(e))):(console.log(`creating worker from createWorker`),new n.WorkerWrapper(await r.createWorker(e)))}};exports.WorkerFactory=r;