function m(e){return new Worker(""+new URL("../assets/embedder-worker-cVTK1uUa.js",import.meta.url).href,{type:"module",name:e?.name})}const f="Xenova/bge-small-en-v1.5",w=384;function p(){return w}function y(){return f}const a=typeof window<"u"&&window.FindAstraConfig||{},g=a.assets&&(a.assets.wasm_via||a.assets.dist)||"";let n=null,i=1;const o=new Map;function c(){return n||(n=new m,n.onmessage=e=>{const t=e.data||{},r=o.get(t.id);if(r){if(t.type==="progress"){if(typeof r.onProgress=="function")try{r.onProgress(t.event)}catch{}return}o.delete(t.id),t.type==="result"?r.resolve(t.vectors||[]):r.reject(new Error(t.message||"embedder worker error"))}},n.onerror=e=>{const t=e&&e.message?e.message:"embedder worker crashed";for(const[r,s]of o)s.reject(new Error(t)),o.delete(r);n=null},n.postMessage({type:"init",wasmPath:g}),n)}function d(){const e=i;return i+=1,e}function k(e,t){if(!Array.isArray(e)||e.length===0)return Promise.resolve([]);const r=c(),s=d();return new Promise((u,l)=>{o.set(s,{resolve:u,reject:l,onProgress:t}),r.postMessage({id:s,type:"embed",inputs:e})})}function b(){const e=()=>{const t=c(),r=d();o.set(r,{resolve:()=>{},reject:s=>console.warn("[FindAstra] prewarm failed (non-fatal):",s&&s.message)}),t.postMessage({id:r,type:"prewarm"})};typeof requestIdleCallback=="function"?requestIdleCallback(e,{timeout:2e3}):setTimeout(e,200)}export{k as embed,p as getDims,y as getModel,b as prewarm};
//# sourceMappingURL=embedder-CEK0uOnA.js.map
