export const env = new Proxy(_env, {
    get: (_, name) => _env(name),
    apply: (_, __, args) => _env(...args),
});
function _env(name, value, error) {
    if (value !== undefined) {
        return value;
    }
    if (name in environment) {
        return environment[name];
    }
    throw new Error(error ?? `Environment variable ${name} is not set`);
}
const environment = await (async () => {
    if (typeof process !== "undefined") {
        return process.env;
    }
    try {
        const { env } = await import("cloudflare:workers");
        return env;
    }
    catch (_error) { }
    if (typeof import.meta !== "undefined") {
        return import.meta.env;
    }
    throw new Error("No environment found");
})();
//# sourceMappingURL=env.js.map