import { o as normalizeOptionalLowercaseString } from "./string-coerce-CIT1-v_a.js";
import { a as normalizeModelCompat } from "./provider-model-compat-CJ-O_XVG.js";
import "./provider-model-shared-DkmyZ3nD.js";
import "./text-runtime-Drz6LusC.js";
//#region extensions/github-copilot/models.ts
const PROVIDER_ID = "github-copilot";
const CODEX_GPT_54_MODEL_ID = "gpt-5.4";
const CODEX_TEMPLATE_MODEL_IDS = ["gpt-5.2-codex"];
const DEFAULT_CONTEXT_WINDOW = 128e3;
const DEFAULT_MAX_TOKENS = 8192;
function resolveCopilotTransportApi(modelId) {
	return (normalizeOptionalLowercaseString(modelId) ?? "").includes("claude") ? "anthropic-messages" : "openai-responses";
}
function resolveCopilotForwardCompatModel(ctx) {
	const trimmedModelId = ctx.modelId.trim();
	if (!trimmedModelId) return;
	const lowerModelId = normalizeOptionalLowercaseString(trimmedModelId) ?? "";
	if (ctx.modelRegistry.find("github-copilot", lowerModelId)) return;
	if (lowerModelId === CODEX_GPT_54_MODEL_ID) for (const templateId of CODEX_TEMPLATE_MODEL_IDS) {
		const template = ctx.modelRegistry.find(PROVIDER_ID, templateId);
		if (!template) continue;
		return normalizeModelCompat({
			...template,
			id: trimmedModelId,
			name: trimmedModelId
		});
	}
	const reasoning = /^o[13](\b|$)/.test(lowerModelId);
	return normalizeModelCompat({
		id: trimmedModelId,
		name: trimmedModelId,
		provider: PROVIDER_ID,
		api: resolveCopilotTransportApi(trimmedModelId),
		reasoning,
		input: ["text", "image"],
		cost: {
			input: 0,
			output: 0,
			cacheRead: 0,
			cacheWrite: 0
		},
		contextWindow: DEFAULT_CONTEXT_WINDOW,
		maxTokens: DEFAULT_MAX_TOKENS
	});
}
//#endregion
export { resolveCopilotForwardCompatModel as n, resolveCopilotTransportApi as r, PROVIDER_ID as t };
