"use strict";exports.id=12,exports.ids=[12],exports.modules={80012:(a,b,c)=>{c.d(b,{proxyAwareFetch:()=>p});var d=c(27910);let e=globalThis.fetch,f=new Map,g=new Map,h=["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com","api2.cursor.sh"],i=["8.8.8.8","8.8.4.4"];function j(a){return null==a?"":String(a).trim()}async function k(a){let b=g.get(a);if(b&&Date.now()<b.expiry)return b.ip;try{let b=await Promise.resolve().then(c.t.bind(c,14985,23)),{promisify:d}=await Promise.resolve().then(c.t.bind(c,28354,23)),e=new b.Resolver;e.setServers(i);let f=d(e.resolve4.bind(e)),h=await f(a);return g.set(a,{ip:h[0],expiry:Date.now()+3e5}),h[0]}catch(b){return console.warn(`[ProxyFetch] DNS resolve failed for ${a}:`,b.message),null}}function l(a,b){let c,d=j(b);if(!d)return!1;try{c=new URL(a).hostname.toLowerCase()}catch{return!1}return d.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean).some(a=>"*"===a||(a.startsWith(".")?c.endsWith(a)||c===a.slice(1):c===a||c.endsWith(`.${a}`)))}function m(a){let b=j(a);if(!b)return null;try{return new URL(b),b}catch{return`http://${b}`}}async function n(a){let b=m(a);if(!b)return null;if(!f.has(b)){f.size>=20&&f.delete(f.keys().next().value);let{ProxyAgent:a}=await Promise.resolve().then(c.t.bind(c,25814,19));f.set(b,new a({uri:b}))}return f.get(b)}async function o(a,b,e){let f=await Promise.resolve().then(c.t.bind(c,55591,23)),g=await Promise.resolve().then(c.t.bind(c,91645,23)),h=f.default??f,i=g.default??g;return new Promise((c,f)=>{let g=new i.Socket;g.connect(443,b,()=>{let b={socket:g,servername:a.hostname,path:a.pathname+a.search,method:e.method||"POST",headers:{...e.headers,Host:a.hostname}},i=h.request(b,a=>{let b={ok:a.statusCode>=200&&a.statusCode<300,status:a.statusCode,statusText:a.statusMessage,headers:new Map(Object.entries(a.headers)),body:d.Readable.toWeb(a),text:async()=>{let b=[];for await(let c of a)b.push(c);return Buffer.concat(b).toString()},json:async()=>JSON.parse(await b.text())};c(b)});i.on("error",f),e.body&&i.write("string"==typeof e.body?e.body:JSON.stringify(e.body)),i.end()}),g.on("error",f)})}async function p(a,b={},c=null){let d="string"==typeof a?a:a.toString(),f=j(c?.vercelRelayUrl);if(f){let a=new URL(d),c={...b.headers,"x-relay-target":`${a.protocol}//${a.host}`,"x-relay-path":`${a.pathname}${a.search}`};return e(f,{...b,headers:c})}let g=function(a,b){if(b?.enabled!==!0&&b?.connectionProxyEnabled!==!0)return null;let c=j(b?.url??b?.connectionProxyUrl);if(!c)return null;let d=j(b?.noProxy??b?.connectionNoProxy);return d&&l(a,d)?null:m(c)}(d,c),i=g?null:m(function(a){let b;if(l(a,process.env.NO_PROXY||process.env.no_proxy))return null;try{b=new URL(a).protocol}catch{return null}return"https:"===b?process.env.HTTPS_PROXY||process.env.https_proxy||process.env.ALL_PROXY||process.env.all_proxy:process.env.HTTP_PROXY||process.env.http_proxy||process.env.ALL_PROXY||process.env.all_proxy}(d)),q=g||i;if(function(a){try{let b=new URL(a).hostname;return h.some(a=>b.includes(a))}catch{return!1}}(d)){if(q)try{let c=await n(q);return await e(a,{...b,dispatcher:c})}catch(a){if(c?.strictProxy===!0)throw Error(`[ProxyFetch] Proxy required but failed (strictProxy=true): ${a.message}`);console.warn(`[ProxyFetch] Proxy failed, falling back to direct bypass: ${a.message}`)}try{let a=new URL(d),c=await k(a.hostname);if(c)return await o(a,c,b)}catch(a){console.warn(`[ProxyFetch] MITM bypass failed: ${a.message}`)}}if(q)try{let c=await n(q);return await e(a,{...b,dispatcher:c})}catch(a){if(c?.strictProxy===!0)throw Error(`[ProxyFetch] Proxy required but failed (strictProxy=true): ${a.message}`);console.warn(`[ProxyFetch] Proxy failed, falling back to direct: ${a.message}`)}return e(a,b)}async function q(a,b={}){return p(a,b,null)}globalThis.fetch!==q&&(globalThis.fetch=q)}};