"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/env.ts
var env_exports = {};
__export(env_exports, {
  ANTHROPIC_API_KEY: () => ANTHROPIC_API_KEY,
  MATCH_BY_POSITION: () => MATCH_BY_POSITION,
  MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON: () => MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON,
  MIDSCENE_AZURE_OPENAI_SCOPE: () => MIDSCENE_AZURE_OPENAI_SCOPE,
  MIDSCENE_CACHE: () => MIDSCENE_CACHE,
  MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG: () => MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG,
  MIDSCENE_DEBUG_AI_PROFILE: () => MIDSCENE_DEBUG_AI_PROFILE,
  MIDSCENE_DEBUG_MODE: () => MIDSCENE_DEBUG_MODE,
  MIDSCENE_LANGSMITH_DEBUG: () => MIDSCENE_LANGSMITH_DEBUG,
  MIDSCENE_MODEL_NAME: () => MIDSCENE_MODEL_NAME,
  MIDSCENE_MODEL_TEXT_ONLY: () => MIDSCENE_MODEL_TEXT_ONLY,
  MIDSCENE_OPENAI_INIT_CONFIG_JSON: () => MIDSCENE_OPENAI_INIT_CONFIG_JSON,
  MIDSCENE_OPENAI_SOCKS_PROXY: () => MIDSCENE_OPENAI_SOCKS_PROXY,
  MIDSCENE_REPORT_TAG_NAME: () => MIDSCENE_REPORT_TAG_NAME,
  MIDSCENE_USE_ANTHROPIC_SDK: () => MIDSCENE_USE_ANTHROPIC_SDK,
  MIDSCENE_USE_AZURE_OPENAI: () => MIDSCENE_USE_AZURE_OPENAI,
  OPENAI_API_KEY: () => OPENAI_API_KEY,
  OPENAI_BASE_URL: () => OPENAI_BASE_URL,
  OPENAI_USE_AZURE: () => OPENAI_USE_AZURE,
  allAIConfig: () => allAIConfig,
  getAIConfig: () => getAIConfig,
  getAIConfigInJson: () => getAIConfigInJson,
  overrideAIConfig: () => overrideAIConfig
});
module.exports = __toCommonJS(env_exports);
var MIDSCENE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_OPENAI_INIT_CONFIG_JSON";
var MIDSCENE_MODEL_NAME = "MIDSCENE_MODEL_NAME";
var MIDSCENE_LANGSMITH_DEBUG = "MIDSCENE_LANGSMITH_DEBUG";
var MIDSCENE_DEBUG_AI_PROFILE = "MIDSCENE_DEBUG_AI_PROFILE";
var MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = "MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG";
var MIDSCENE_DEBUG_MODE = "MIDSCENE_DEBUG_MODE";
var MIDSCENE_OPENAI_SOCKS_PROXY = "MIDSCENE_OPENAI_SOCKS_PROXY";
var OPENAI_API_KEY = "OPENAI_API_KEY";
var OPENAI_BASE_URL = "OPENAI_BASE_URL";
var MIDSCENE_MODEL_TEXT_ONLY = "MIDSCENE_MODEL_TEXT_ONLY";
var MIDSCENE_CACHE = "MIDSCENE_CACHE";
var MATCH_BY_POSITION = "MATCH_BY_POSITION";
var MIDSCENE_REPORT_TAG_NAME = "MIDSCENE_REPORT_TAG_NAME";
var MIDSCENE_USE_AZURE_OPENAI = "MIDSCENE_USE_AZURE_OPENAI";
var MIDSCENE_AZURE_OPENAI_SCOPE = "MIDSCENE_AZURE_OPENAI_SCOPE";
var MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON = "MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON";
var MIDSCENE_USE_ANTHROPIC_SDK = "MIDSCENE_USE_ANTHROPIC_SDK";
var ANTHROPIC_API_KEY = "ANTHROPIC_API_KEY";
var OPENAI_USE_AZURE = "OPENAI_USE_AZURE";
var allConfigFromEnv = () => {
  return {
    [MIDSCENE_OPENAI_INIT_CONFIG_JSON]: process.env[MIDSCENE_OPENAI_INIT_CONFIG_JSON] || void 0,
    [MIDSCENE_MODEL_NAME]: process.env[MIDSCENE_MODEL_NAME] || void 0,
    [MIDSCENE_DEBUG_MODE]: process.env[MIDSCENE_DEBUG_MODE] || void 0,
    [MIDSCENE_LANGSMITH_DEBUG]: process.env[MIDSCENE_LANGSMITH_DEBUG] || void 0,
    [MIDSCENE_DEBUG_AI_PROFILE]: process.env[MIDSCENE_DEBUG_AI_PROFILE] || void 0,
    [MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG]: process.env[MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG] || void 0,
    [OPENAI_API_KEY]: process.env[OPENAI_API_KEY] || void 0,
    [OPENAI_BASE_URL]: process.env[OPENAI_BASE_URL] || void 0,
    [MIDSCENE_MODEL_TEXT_ONLY]: process.env[MIDSCENE_MODEL_TEXT_ONLY] || void 0,
    [OPENAI_USE_AZURE]: process.env[OPENAI_USE_AZURE] || void 0,
    [MIDSCENE_CACHE]: process.env[MIDSCENE_CACHE] || void 0,
    [MATCH_BY_POSITION]: process.env[MATCH_BY_POSITION] || void 0,
    [MIDSCENE_REPORT_TAG_NAME]: process.env[MIDSCENE_REPORT_TAG_NAME] || void 0,
    [MIDSCENE_OPENAI_SOCKS_PROXY]: process.env[MIDSCENE_OPENAI_SOCKS_PROXY] || void 0,
    [MIDSCENE_USE_AZURE_OPENAI]: process.env[MIDSCENE_USE_AZURE_OPENAI] || void 0,
    [MIDSCENE_AZURE_OPENAI_SCOPE]: process.env[MIDSCENE_AZURE_OPENAI_SCOPE] || "https://cognitiveservices.azure.com/.default",
    [MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON]: process.env[MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON] || void 0,
    [MIDSCENE_USE_ANTHROPIC_SDK]: process.env[MIDSCENE_USE_ANTHROPIC_SDK] || void 0,
    [ANTHROPIC_API_KEY]: process.env[ANTHROPIC_API_KEY] || void 0
  };
};
var userConfig = {};
var getAIConfig = (configKey) => {
  if (typeof userConfig[configKey] !== "undefined") {
    return userConfig[configKey];
  }
  return allConfigFromEnv()[configKey];
};
var getAIConfigInJson = (configKey) => {
  const config = getAIConfig(configKey);
  try {
    return config ? JSON.parse(config) : void 0;
  } catch (error) {
    throw new Error(
      `Failed to parse json config: ${configKey}. ${error.message}`,
      {
        cause: error
      }
    );
  }
};
var allAIConfig = () => {
  return { ...allConfigFromEnv(), ...userConfig };
};
var overrideAIConfig = (newConfig, extendMode) => {
  userConfig = extendMode ? { ...userConfig, ...newConfig } : { ...newConfig };
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ANTHROPIC_API_KEY,
  MATCH_BY_POSITION,
  MIDSCENE_AZURE_OPENAI_INIT_CONFIG_JSON,
  MIDSCENE_AZURE_OPENAI_SCOPE,
  MIDSCENE_CACHE,
  MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG,
  MIDSCENE_DEBUG_AI_PROFILE,
  MIDSCENE_DEBUG_MODE,
  MIDSCENE_LANGSMITH_DEBUG,
  MIDSCENE_MODEL_NAME,
  MIDSCENE_MODEL_TEXT_ONLY,
  MIDSCENE_OPENAI_INIT_CONFIG_JSON,
  MIDSCENE_OPENAI_SOCKS_PROXY,
  MIDSCENE_REPORT_TAG_NAME,
  MIDSCENE_USE_ANTHROPIC_SDK,
  MIDSCENE_USE_AZURE_OPENAI,
  OPENAI_API_KEY,
  OPENAI_BASE_URL,
  OPENAI_USE_AZURE,
  allAIConfig,
  getAIConfig,
  getAIConfigInJson,
  overrideAIConfig
});
