const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DyrDLY-6.js","./BSRD1o6J.js","./D7w7HllH.js","./DrKWWDpL.js","./DB5ifLM-.js","./FTvwzCka2.js","./DsQIgu-4.js","./yX3I--Np.js","./DiIbXgam.js","./DOqzs8kl2.js","./DYP3EJMY.js","./DTkg6Mnx.js","./DIQmuJJZ.js","./BSkUUZJr2.js","./kwfd020K.js","./CxlOpib82.js","./BDDiPmhF.js","./BYJC6_MM.js","./CX8DOZuw2.js","./BMGkukPk.js","./DoOTPDI-.js","./DO4myGf_.js","./ByMOJ7vP.js","./DcRYz7Nf.js","./vZvGnEXu.js","./DqqGGCj32.js","./b2R8Ad-3.js","./Od6vz3AQ.js","./CMdgFTSd.js","./CvWN0JfP.js"])))=>i.map(i=>d[i]);
import{n as e,t}from"./DsQIgu-4.js";e();var n=[`gemma4:e4b-it`,`gemma4:e2b-it`,`gemma4:e2b`,`phi4-mini`,`llama3.2:3b`,`llama3.2`],r=`claude-sonnet-4-6`,i=`onnx-community/Qwen2.5-0.5B-Instruct`;async function a(e){return await d()||(e===`warm`?await o()||await s()||a(`cold`):e===`cold`?await c(r):null)}async function o(){try{let e=await fetch(`http://localhost:11434/api/tags`,{signal:AbortSignal.timeout(2e3)});if(!e.ok)return null;let r=((await e.json()).models??[]).map(e=>e.name??e.model??``).filter(Boolean);if(r.length===0)return null;let i;for(let e of n)if(r.some(t=>t===e||t.startsWith(e.split(`:`)[0]))){i=e;break}i||=r[0];let{createOpenAICompatible:a}=await t(async()=>{let{createOpenAICompatible:e}=await import(`./DyrDLY-6.js`);return{createOpenAICompatible:e}},__vite__mapDeps([0,1,2,3,4]),import.meta.url);return{model:a({baseURL:`http://localhost:11434/v1`,name:`ollama`})(i),name:`ollama`,modelId:i}}catch{return null}}async function s(){try{let{env:e}=await t(async()=>{let{env:e}=await import(`./FTvwzCka2.js`);return{env:e}},__vite__mapDeps([5,3,6]),import.meta.url);return e===void 0?null:{model:null,name:`transformers`,modelId:i}}catch{return null}}async function c(e){try{let{resolveCredentials:n}=await t(async()=>{let{resolveCredentials:e}=await import(`./yX3I--Np.js`);return{resolveCredentials:e}},__vite__mapDeps([7,8,3,9,10,11,12,2,4,13,14,15,16,17,18,6,19,20,21,22]),import.meta.url),r=n(`anthropic`).apiKey;if(!r)return null;let{createAnthropic:i}=await t(async()=>{let{createAnthropic:e}=await import(`./DcRYz7Nf.js`);return{createAnthropic:e}},__vite__mapDeps([23,1,2,3,4]),import.meta.url);return{model:i({apiKey:r})(e),name:`anthropic`,modelId:e}}catch{return null}}var l=`http://localhost:11434/v1`;async function u(e){if(e===`ollama`)return l;try{let{getProviderProfile:n}=await t(async()=>{let{getProviderProfile:e}=await import(`./vZvGnEXu.js`);return{getProviderProfile:e}},__vite__mapDeps([24,19,3,6,20,9,10,18,12,2,4,15]),import.meta.url),r=await n(e);if(r?.baseUrl)return r.baseUrl}catch{}if(e===`openai`)return`https://api.openai.com/v1`}async function d(){try{let{resolveLLMForSystem:e}=await t(async()=>{let{resolveLLMForSystem:e}=await import(`./DqqGGCj32.js`);return{resolveLLMForSystem:e}},__vite__mapDeps([25,6,3,11,10,12,2,4,26,27,28,13,14,15,16,17,18,9,29,8,19,20,21,22]),import.meta.url),n=await e({kind:`role`,id:`extraction`},{skipCatalogDefault:!0}),r=n.sealedCredential?(await n.sealedCredential.fetch()).value:null;if(n.provider===`anthropic`){if(!r)return null;let{createAnthropic:e}=await t(async()=>{let{createAnthropic:e}=await import(`./DcRYz7Nf.js`);return{createAnthropic:e}},__vite__mapDeps([23,1,2,3,4]),import.meta.url);return{model:e({apiKey:r})(n.model),name:`anthropic`,modelId:n.model}}if(n.provider===`openai`||n.provider===`ollama`){let e=await u(n.provider);if(!e)return null;let{createOpenAICompatible:i}=await t(async()=>{let{createOpenAICompatible:e}=await import(`./DyrDLY-6.js`);return{createOpenAICompatible:e}},__vite__mapDeps([0,1,2,3,4]),import.meta.url);return{model:i({baseURL:e,name:n.provider,...r?{apiKey:r}:{}})(n.model),name:n.provider===`ollama`?`ollama`:`openai`,modelId:n.model}}return null}catch{return null}}export{a as t};