import { T, n, r } from "../../../../node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs";
import { FetchError, createFetch, createFetchError } from "./shared/ofetch.CWycOUEr.mjs";
import http from "node:http";
import https from "node:https";

//#region ../../node_modules/.pnpm/ofetch@1.5.1/node_modules/ofetch/dist/node.mjs
function createNodeFetch() {
	if (!JSON.parse(process.env.FETCH_KEEP_ALIVE || "false")) return r;
	const agentOptions = { keepAlive: true };
	const httpAgent = new http.Agent(agentOptions);
	const httpsAgent = new https.Agent(agentOptions);
	const nodeFetchOptions = { agent(parsedURL) {
		return parsedURL.protocol === "http:" ? httpAgent : httpsAgent;
	} };
	return function nodeFetchWithKeepAlive(input, init) {
		return r(input, {
			...nodeFetchOptions,
			...init
		});
	};
}
const fetch = globalThis.fetch ? (...args) => globalThis.fetch(...args) : createNodeFetch();
const Headers = globalThis.Headers || n;
const AbortController = globalThis.AbortController || T;
const ofetch = createFetch({
	fetch,
	Headers,
	AbortController
});
const $fetch = ofetch;

//#endregion
export { $fetch };