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

//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.21.7_@typescript+native-preview@7.0.0-dev.20260122.2_oxc-resolver_6ee2f4f55d91906623f5bd81116dd39c/node_modules/rolldown-plugin-dts/dist/resolver-o20sdYK5.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 };