import { t as createDebug } from "./node-Cb5OsnKg.js";

//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.22.1_@typescript+native-preview@7.0.0-dev.20260122.2_oxc-resolver_d2e4a246ecba2d40b4415d1b79df8dc9/node_modules/rolldown-plugin-dts/dist/resolver-j7HY1N36.mjs
const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
const path = globalThis.process.getBuiltinModule("node:path");
const ts = __cjs_require("typescript");
const debug = createDebug("rolldown-plugin-dts:tsc-resolver");
function tscResolve(id, importer, cwd, tsconfig, tsconfigRaw, reference) {
	const baseDir = tsconfig ? path.dirname(tsconfig) : cwd;
	const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, ts.sys, baseDir);
	const resolved = ts.bundlerModuleNameResolver(id, importer, {
		moduleResolution: ts.ModuleResolutionKind.Bundler,
		...parsedConfig.options
	}, ts.sys, void 0, reference);
	debug(`tsc resolving id "%s" from "%s" -> %O`, id, importer, resolved.resolvedModule);
	return resolved.resolvedModule?.resolvedFileName;
}

//#endregion
export { tscResolve };