import { RUNTIME_MODULE_ID } from "@voidzero-dev/vite-plus-core/rolldown";
import { exactRegex } from "@voidzero-dev/vite-plus-core/rolldown/filter";

//#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/filename.mjs
const RE_JS = /\.([cm]?)jsx?$/;
const RE_TS = /\.([cm]?)tsx?$/;
const RE_DTS = /\.d\.([cm]?)ts$/;
const RE_DTS_MAP = /\.d\.([cm]?)ts\.map$/;
const RE_NODE_MODULES = /[\\/]node_modules[\\/]/;
const RE_CSS = /\.css$/;
const RE_VUE = /\.vue$/;
const RE_JSON = /\.json$/;
const RE_ROLLDOWN_RUNTIME = exactRegex(RUNTIME_MODULE_ID);
function filename_js_to_dts(id) {
	return id.replace(RE_JS, ".d.$1ts");
}
function filename_to_dts(id) {
	return id.replace(RE_VUE, ".vue.ts").replace(RE_TS, ".d.$1ts").replace(RE_JS, ".d.$1ts").replace(RE_JSON, ".json.d.ts");
}
function filename_dts_to(id, ext) {
	return id.replace(RE_DTS, `.$1${ext}`);
}
function resolveTemplateFn(fn, chunk) {
	return typeof fn === "function" ? fn(chunk) : fn;
}
function replaceTemplateName(template, name) {
	return template.replaceAll("[name]", name);
}

//#endregion
export { RE_JSON as a, RE_TS as c, filename_js_to_dts as d, filename_to_dts as f, RE_JS as i, RE_VUE as l, resolveTemplateFn as m, RE_DTS as n, RE_NODE_MODULES as o, replaceTemplateName as p, RE_DTS_MAP as r, RE_ROLLDOWN_RUNTIME as s, RE_CSS as t, filename_dts_to as u };