import{g as y}from"./gQJcRhou.js";import"./BDcFu3l7.js";const R="https://unpkg.com/@juspay/neurolink@9.61.1/dist/browser/neurolink.min.js",u={"https://api.anthropic.com/":"anthropic","https://api.mistral.ai/":"mistral","https://api.openai.com/":"openai","https://generativelanguage.googleapis.com/":"google-ai"};let p=!1;function k(){if(p||typeof globalThis>"u")return;p=!0;const t=globalThis.fetch.bind(globalThis);globalThis.fetch=async(e,o)=>{const s=typeof e=="string"?e:e instanceof URL?e.href:e.url,a=m(s);if(!a)return t(e,o);const i={},r=o?.headers??(e instanceof Request?e.headers:{}),d=r instanceof Headers?r:Object.entries(r);for(const[f,g]of d){const h=f.toLowerCase();h!=="x-api-key"&&h!=="authorization"&&(i[f]=g)}let n;try{n=JSON.parse(o?.body??(e instanceof Request?await e.text():"{}"))}catch{n={}}const c=y(),l={"Content-Type":"application/json"};return c&&(l.Authorization=`Bearer ${c}`),t("/api/neurolink-proxy",{body:JSON.stringify({body:n,headers:i,provider:a,url:s}),headers:l,method:"POST"})}}function b(){if(typeof window>"u")return"";const e=window.process?.env?.LITELLM_BASE_URL;return typeof e=="string"?e:""}function m(t){const e=Object.entries(u).find(([s])=>t.startsWith(s))?.[1];if(e)return e;const o=b();if(o&&t.startsWith(o))return"litellm"}export{R as N,k as i};
